i124638 Second step of DrawingLayer FillAttributes for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes

Notes:

merged as: 7d9bb549d498d6beed2c4050c402d09643febdfa
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 2c38a1e..69470aa 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1363,12 +1363,20 @@ AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchS
    return NULL;
}

SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( Window* pParent,
                                            const SfxItemSet& rCoreSet,
                                            sal_Bool bEnableSelector)
//UUUU
SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg(
    Window* pParent,
    const SfxItemSet& rCoreSet,
    bool bEnableSelector,
    bool bEnableDrawingLayerFillStyles)
{
    SfxTabDialog* pDlg = new SvxBorderBackgroundDlg( pParent, rCoreSet, bEnableSelector);
    return new AbstractTabDialog_Impl( pDlg );
    SfxTabDialog* pDlg = new SvxBorderBackgroundDlg(
        pParent,
        rCoreSet,
        bEnableSelector,
        bEnableDrawingLayerFillStyles);

    return new AbstractTabDialog_Impl(pDlg);
}

AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index cdb579b..39fb0b6 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -647,9 +647,14 @@ public:
   virtual AbstractFmShowColsDialog * CreateFmShowColsDialog( Window* pParent );  //add for FmShowColsDialog
   virtual AbstractSvxZoomDialog * CreateSvxZoomDialog( Window* pParent,  //add for SvxZoomDialog
                                            const SfxItemSet& rCoreSet);
   virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, //add for SvxBorderBackgroundDlg
                                            const SfxItemSet& rCoreSet,
                                            sal_Bool bEnableSelector = sal_False) ;

   //UUUU add for SvxBorderBackgroundDlg
   virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg(
       Window* pParent,
       const SfxItemSet& rCoreSet,
       bool bEnableSelector = false,
       bool bEnableDrawingLayerFillStyles = false);

   virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, //add for SvxTransformTabDialog
                                                                const SfxItemSet* pAttr,
                                                                const SdrView* pView,
diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx
index fe2ac34..51cb1ba 100644
--- a/cui/source/inc/bbdlg.hxx
+++ b/cui/source/inc/bbdlg.hxx
@@ -34,17 +34,20 @@
class SvxBorderBackgroundDlg: public SfxTabDialog
{
public:
    SvxBorderBackgroundDlg( Window *pParent,
                            const SfxItemSet& rCoreSet,
                            sal_Bool bEnableSelector = sal_False );
    SvxBorderBackgroundDlg(Window *pParent,
        const SfxItemSet& rCoreSet,
        bool bEnableSelector = false,
        bool bEnableDrawingLayerFillStyles = false);

    ~SvxBorderBackgroundDlg();

protected:
    virtual void    PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage );
    virtual void    PageCreated(sal_uInt16 nPageId,SfxTabPage& rTabPage);

private:
    sal_Bool    bEnableBackgroundSelector; // fuer Border/Background-Dlg
    /// bitfield
    bool        mbEnableBackgroundSelector : 1;         // fuer Border/Background-Dlg
    bool        mbEnableDrawingLayerFillStyles : 1;     // for full DrawingLayer FillStyles
};


diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index 7a0dac2..17f5fc7 100755
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -42,7 +42,11 @@
#define RID_SVXDLG_TEXT                     (RID_SVX_START + 183)
#define RID_SVXDLG_TRANSFORM                (RID_SVX_START +  45)
#define RID_SVXDLG_LINE                     (RID_SVX_START +  50)
#define RID_SVXDLG_BBDLG                    (RID_SVX_START +  40)

//UUUU
#define RID_SVXDLG_BBDLG_BACKGROUND         (RID_SVX_START +  40)
#define RID_SVXDLG_BBDLG_AREA_TRANS         (RID_SVX_START +  41)

#define RID_SVXDLG_CAPTION                  (RID_SVX_START + 151)
#define RID_SVXDLG_AREA                     (RID_SVX_START +  55)
#define RID_SVXSTRARY_PAPERSIZE_STD         (RID_SVX_START + 142)
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index f49e36d..1222215 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -80,7 +80,7 @@
        <SvxLRSpaceItem>:       <SID_ATTR_LRSPACE>
*/

struct  SvxPage_Impl;
//UUUU struct   SvxPage_Impl;
typedef sal_uInt16 MarginPosition;

class SvxPageDescPage : public SfxTabPage
@@ -88,6 +88,7 @@ class SvxPageDescPage : public SfxTabPage
    using TabPage::ActivatePage;
    using TabPage::DeactivatePage;

private:
    // paper format
    FixedLine           aPaperSizeFl;
    FixedText           aPaperFormatText;
@@ -167,7 +168,14 @@ class SvxPageDescPage : public SfxTabPage
    Paper               ePaperStart;
    Paper               ePaperEnd;

    SvxPage_Impl*       pImpl;
    //UUUU SvxPage_Impl*        pImpl;
    MarginPosition      m_nPos;
    Printer*            mpDefPrinter;

    bool                mbDelPrinter : 1;

    //UUUU
    bool mbEnableDrawingLayerFillStyles : 1;

#ifdef _SVX_PAGE_CXX
    void                Init_Impl();
@@ -208,6 +216,9 @@ class SvxPageDescPage : public SfxTabPage

    SvxPageDescPage( Window* pParent, const SfxItemSet& rSet );

    //UUUU
    void EnableDrawingLayerFillStyles(bool bNew) { mbEnableDrawingLayerFillStyles = bNew; }

protected:
    virtual void        ActivatePage( const SfxItemSet& rSet );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx
index afaf3c4..7d8c604 100644
--- a/cui/source/tabpages/bbdlg.cxx
+++ b/cui/source/tabpages/bbdlg.cxx
@@ -35,18 +35,37 @@
#include "backgrnd.hxx"
#include <dialmgr.hxx>

//UUUU
#include "cuitabarea.hxx"

// class SvxBorderBackgroundDlg ------------------------------------------

SvxBorderBackgroundDlg::SvxBorderBackgroundDlg( Window *pParent,
                                                const SfxItemSet& rCoreSet,
                                                sal_Bool bEnableSelector ) :

    SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_BBDLG ), &rCoreSet ),
    bEnableBackgroundSelector( bEnableSelector )
SvxBorderBackgroundDlg::SvxBorderBackgroundDlg(Window *pParent,
    const SfxItemSet& rCoreSet,
    bool bEnableSelector,
    bool bEnableDrawingLayerFillStyles)
:   SfxTabDialog(
        pParent,
        CUI_RES(
            bEnableDrawingLayerFillStyles ? RID_SVXDLG_BBDLG_AREA_TRANS : RID_SVXDLG_BBDLG_BACKGROUND),
        &rCoreSet),
    mbEnableBackgroundSelector(bEnableSelector),
    mbEnableDrawingLayerFillStyles(bEnableDrawingLayerFillStyles)
{
    FreeResource();
    AddTabPage( RID_SVXPAGE_BORDER, SvxBorderTabPage::Create, 0 );
    AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 );
    AddTabPage(RID_SVXPAGE_BORDER,SvxBorderTabPage::Create,0);

    if(mbEnableDrawingLayerFillStyles)
    {
        //UUUU Here we want full DrawingLayer FillStyle access, so add Area and Transparency TabPages
        AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 );
        AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create,  0);
    }
    else
    {
        //UUUU Use the more simple Background TabPage
        AddTabPage(RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0);
    }
}

// -----------------------------------------------------------------------
@@ -57,12 +76,48 @@ SvxBorderBackgroundDlg::~SvxBorderBackgroundDlg()

// -----------------------------------------------------------------------

void SvxBorderBackgroundDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
void SvxBorderBackgroundDlg::PageCreated(sal_uInt16 nPageId, SfxTabPage& rTabPage)
{
    // Umschalten zwischen Farbe/Grafik ermoeglichen:
    switch(nPageId)
    {
        case RID_SVXPAGE_BACKGROUND:
        {
            // allow switching between Color/graphic
            if(mbEnableBackgroundSelector)
            {
                static_cast< SvxBackgroundTabPage& >(rTabPage).ShowSelector();
            }
            break;
        }

    if ( bEnableBackgroundSelector && (RID_SVXPAGE_BACKGROUND == nPageId) )
        ((SvxBackgroundTabPage&)rTabPage).ShowSelector( );
        //UUUU inits for Area and Transparency TabPages
        // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
        // the color table) need to be added as items (e.g. SvxColorTableItem) to make
        // these pages find the needed attributes for fill style suggestions.
        // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
        // demand, but could also be directly added from the DrawModel.
        case RID_SVXPAGE_AREA:
        {
            SfxItemSet aNew(
                *GetInputSetImpl()->GetPool(),
                SID_COLOR_TABLE, SID_BITMAP_LIST,
                SID_OFFER_IMPORT, SID_OFFER_IMPORT,
                0, 0);

            aNew.Put(*GetInputSetImpl());

            // add flag for direct graphic content selection
            aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));

            rTabPage.PageCreated(aNew);
            break;
        }
        case RID_SVXPAGE_TRANSPARENCE:
        {
            rTabPage.PageCreated(*GetInputSetImpl());
            break;
        }
    }
}


//eof
diff --git a/cui/source/tabpages/bbdlg.src b/cui/source/tabpages/bbdlg.src
index 520884a..6a8ebc1 100644
--- a/cui/source/tabpages/bbdlg.src
+++ b/cui/source/tabpages/bbdlg.src
@@ -24,15 +24,16 @@
#include <cuires.hrc>
#include <svx/dialogs.hrc>

 // RID_SVXDLG_BBDLG ------------------------------------------------------
TabDialog RID_SVXDLG_BBDLG
// RID_SVXDLG_BBDLG_BACKGROUND and RID_SVXDLG_BBDLG_AREA_TRANS ------------

TabDialog RID_SVXDLG_BBDLG_BACKGROUND
{
    OutputSize = TRUE ;
    SVLook = TRUE ;
    Size = MAP_APPFONT ( 328 , 155 ) ;
    Text [ en-US ] = "Border / Background" ;
    Moveable = TRUE ;
     // Closeable = TRUE; hat ja einen OKButton

    TabControl 1
    {
        OutputSize = TRUE ;
@@ -53,6 +54,45 @@ TabDialog RID_SVXDLG_BBDLG
        };
    };
};

TabDialog RID_SVXDLG_BBDLG_AREA_TRANS
{
    OutputSize = TRUE ;
    SVLook = TRUE ;
    Size = MAP_APPFONT ( 328 , 155 ) ;
    Text [ en-US ] = "Border / Background" ;
    Moveable = TRUE ;

    TabControl 1
    {
        OutputSize = TRUE ;
        Pos = MAP_APPFONT ( 2 , 10 ) ;
        Size = MAP_APPFONT ( 260 , 135 ) ;
        PageList =
        {
            PageItem
            {
                Identifier = RID_SVXPAGE_BORDER ;
                Text [ en-US ] = "Borders" ;
            };

            //UUUU new Area and Transparence TabPages
            PageItem
            {
                Identifier = RID_SVXPAGE_AREA;
                PageResID = RID_SVXPAGE_AREA;
                Text [ en-US ] = "Area" ;
            };
            PageItem
            {
                Identifier = RID_SVXPAGE_TRANSPARENCE;
                PageResID = RID_SVXPAGE_TRANSPARENCE;
                Text [ en-US ] = "Transparency" ;
            };
        };
    };
};

 // ********************************************************************** EOF


diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 3edba4b..887a882 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"

@@ -61,12 +59,15 @@
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc> // for RID_SVXSTR_PAPERBIN...,
#include <svx/svxids.hrc>

// #i4219#
#include <svtools/optionsdrawinglayer.hxx>
#include <svl/slstitm.hxx> //CHINA001
#include <svl/aeitem.hxx> //CHINA001
#include <sfx2/request.hxx> //CHINA001

//UUUU
#include <svx/xdef.hxx>
#include <svx/unobrushitemhelper.hxx>

// configuration helper =======================================================

/** Helper to get a configuration setting.
@@ -208,19 +209,20 @@ sal_Bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
#define MARGIN_TOP      ( (MarginPosition)0x0004 )
#define MARGIN_BOTTOM   ( (MarginPosition)0x0008 )

struct SvxPage_Impl
{
    MarginPosition  m_nPos;
    Printer*        mpDefPrinter;
    bool            mbDelPrinter;

    SvxPage_Impl() :
        m_nPos( 0 ),
        mpDefPrinter( 0 ),
        mbDelPrinter( false ) {}

    ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; }
};
//UUUU
//struct SvxPage_Impl
//{
//  MarginPosition  m_nPos;
//    Printer*        mpDefPrinter;
//    bool            mbDelPrinter;
//
//    SvxPage_Impl() :
//        m_nPos( 0 ),
//        mpDefPrinter( 0 ),
//        mbDelPrinter( false ) {}
//
//    ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; }
//};

// class SvxPageDescPage --------------------------------------------------

@@ -240,10 +242,8 @@ SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet )

// -----------------------------------------------------------------------

SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :

    SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PAGE ), rAttr ),

SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr )
:   SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PAGE ), rAttr ),
    aPaperSizeFl        ( this, CUI_RES( FL_PAPER_SIZE ) ),
    aPaperFormatText    ( this, CUI_RES( FT_PAPER_FORMAT ) ),
    aPaperSizeBox       ( this, CUI_RES( LB_PAPER_SIZE ) ),
@@ -290,8 +290,17 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :
    eMode               ( SVX_PAGE_MODE_STANDARD ),
    ePaperStart         ( PAPER_A3 ),
    ePaperEnd           ( PAPER_ENV_DL ),
    pImpl               ( new SvxPage_Impl )

    //UUUU
    // pImpl                ( new SvxPage_Impl ),

    //UUUU
    m_nPos( 0 ),
    mpDefPrinter( 0 ),
    mbDelPrinter( false ),

    //UUUU
    mbEnableDrawingLayerFillStyles(false)
{
    bBorderModified = sal_False;
    FreeResource();
@@ -351,27 +360,28 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :
    SetFieldUnit( aPaperHeightEdit, eFUnit );

    if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
        pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter();
    {
        mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter();
    }
    else
    {
        pImpl->mpDefPrinter = new Printer;
        pImpl->mbDelPrinter = true;
        mpDefPrinter = new Printer;
        mbDelPrinter = true;
    }

    MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
    pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
    MapMode aOldMode = mpDefPrinter->GetMapMode();
    mpDefPrinter->SetMapMode( MAP_TWIP );

    // First- und Last-Werte f"ur die R"ander setzen
    Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
    Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
    Size aPaperSize = mpDefPrinter->GetPaperSize();
    Size aPrintSize = mpDefPrinter->GetOutputSize();
    /*
     * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren,
     * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des
     * Koordinatensystems verschoben ist.
     */
    Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
                         pImpl->mpDefPrinter->PixelToLogic( Point() );
    pImpl->mpDefPrinter->SetMapMode( aOldMode );
    Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
    mpDefPrinter->SetMapMode( aOldMode );

    long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
    aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP );
@@ -425,7 +435,10 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :

SvxPageDescPage::~SvxPageDescPage()
{
    delete pImpl;
    if(mbDelPrinter)
    {
        delete mpDefPrinter;
    }
}

// -----------------------------------------------------------------------
@@ -509,7 +522,7 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )

    // allgemeine Seitendaten
    SvxNumType eNumType = SVX_ARABIC;
    bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE );
    bLandscape = ( mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE );
    sal_uInt16 nUse = (sal_uInt16)SVX_PAGE_ALL;
    pItem = GetItem( rSet, SID_ATTR_PAGE );

@@ -538,7 +551,7 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
    {
        nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue();

        if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() )
        if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() )
            nPaperBin = PAPERBIN_PRINTER_SETTINGS;
    }

@@ -547,21 +560,21 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
    if ( PAPERBIN_PRINTER_SETTINGS  == nPaperBin )
        aBinName = EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS );
    else
        aBinName = pImpl->mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin );
        aBinName = mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin );

    sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( aBinName );
    aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)nPaperBin );
    aPaperTrayBox.SelectEntry( aBinName );

    // Size rausholen
    Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter );
    Size aPaperSize = SvxPaperInfo::GetPaperSize( mpDefPrinter );
    pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );

    if ( pItem )
        aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize();

    FASTBOOL bOrientationSupport =
        pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION );
        mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION );
#ifdef OS2
    // unter OS/2 wird bei HasSupport() immer sal_True returned
    // aber nur als Dummy, deshalb FALSE
@@ -1005,11 +1018,11 @@ IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG )
    aPaperTrayBox.SetEntryData( nEntryPos,
        (void*)(sal_uLong)PAPERBIN_PRINTER_SETTINGS );
    String aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) );
    sal_uInt16 nBinCount = pImpl->mpDefPrinter->GetPaperBinCount();
    sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount();

    for ( sal_uInt16 i = 0; i < nBinCount; ++i )
    {
        String aName = pImpl->mpDefPrinter->GetPaperBinName(i);
        String aName = mpDefPrinter->GetPaperBinName(i);

        if ( !aName.Len() )
        {
@@ -1158,27 +1171,26 @@ IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn )

void SvxPageDescPage::SwapFirstValues_Impl( FASTBOOL bSet )
{
    MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
    MapMode aOldMode = mpDefPrinter->GetMapMode();
    Orientation eOri = ORIENTATION_PORTRAIT;

    if ( bLandscape )
        eOri = ORIENTATION_LANDSCAPE;
    Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation();
    pImpl->mpDefPrinter->SetOrientation( eOri );
    pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
    Orientation eOldOri = mpDefPrinter->GetOrientation();
    mpDefPrinter->SetOrientation( eOri );
    mpDefPrinter->SetMapMode( MAP_TWIP );

    // First- und Last-Werte f"ur die R"ander setzen
    Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
    Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
    Size aPaperSize = mpDefPrinter->GetPaperSize();
    Size aPrintSize = mpDefPrinter->GetOutputSize();
    /*
     * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren,
     * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des
     * Koordinatensystems verschoben ist.
     */
    Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
                         pImpl->mpDefPrinter->PixelToLogic( Point() );
    pImpl->mpDefPrinter->SetMapMode( aOldMode );
    pImpl->mpDefPrinter->SetOrientation( eOldOri );
    Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
    mpDefPrinter->SetMapMode( aOldMode );
    mpDefPrinter->SetOrientation( eOldOri );

    sal_Int64 nSetL = aLeftMarginEdit.Denormalize(
                    aLeftMarginEdit.GetValue( FUNIT_TWIP ) );
@@ -1260,90 +1272,124 @@ void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )

// -----------------------------------------------------------------------

void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet )
void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
{
    sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
    sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));

    if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
    {
        const SvxSetItem& rSetItem =
            (const SvxSetItem&)rSet.Get( nWhich, sal_False );
        const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
        const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
        const SfxBoolItem& rOn =
            (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
        const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));

        if ( rOn.GetValue() )
        if(rOn.GetValue())
        {
            nWhich = GetWhich( SID_ATTR_BRUSH );
            drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            if(mbEnableDrawingLayerFillStyles)
            {
                const SvxBrushItem& rItem =
                    (const SvxBrushItem&)rTmpSet.Get( nWhich );
                aBspWin.SetHdColor( rItem.GetColor() );
                //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
                aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
            }
            nWhich = GetWhich( SID_ATTR_BORDER_OUTER );

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            else
            {
                const SvxBoxItem& rItem =
                    (const SvxBoxItem&)rTmpSet.Get( nWhich );
                aBspWin.SetHdBorder( rItem );
                nWhich = GetWhich(SID_ATTR_BRUSH);

                if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
                {
                    //UUUU create FillAttributes from SvxBrushItem
                    const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
                    SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                    setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                    aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
                }
            }

            aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
            nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

            if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
            {
                const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
                aBspWin.SetHdBorder(rItem);
            }
        }
    }

    nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
    nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);

    if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
    {
        const SvxSetItem& rSetItem =
            (const SvxSetItem&)rSet.Get( nWhich, sal_False );
        const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,sal_False));
        const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
        const SfxBoolItem& rOn =
            (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
        const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));

        if ( rOn.GetValue() )
        if(rOn.GetValue())
        {
            nWhich = GetWhich( SID_ATTR_BRUSH );
            drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            if(mbEnableDrawingLayerFillStyles)
            {
                const SvxBrushItem& rItem =
                    (const SvxBrushItem&)rTmpSet.Get( nWhich );
                aBspWin.SetFtColor( rItem.GetColor() );
                //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
                aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
            }
            nWhich = GetWhich( SID_ATTR_BORDER_OUTER );

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            else
            {
                const SvxBoxItem& rItem =
                    (const SvxBoxItem&)rTmpSet.Get( nWhich );
                aBspWin.SetFtBorder( rItem );
                nWhich = GetWhich(SID_ATTR_BRUSH);

                if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
                {
                    //UUUU create FillAttributes from SvxBrushItem
                    const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
                    SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                    setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                    aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
                }
            }

            aBspWin.setFooterFillAttributes(aFooterFillAttributes);
            nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

            if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
            {
                const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
                aBspWin.SetFtBorder(rItem);
            }
        }
    }

    const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH );
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
    const SfxPoolItem* pItem = 0;

    if ( pItem )
    if(mbEnableDrawingLayerFillStyles)
    {
        aBspWin.SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
        const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();
        //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
        aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
    }
    else
    {
        pItem = GetItem(rSet, SID_ATTR_BRUSH);

        if ( pGrf )
        if(pItem)
        {
            Bitmap aBitmap = pGrf->GetBitmap();
            aBspWin.SetBitmap( &aBitmap );
            //UUUU create FillAttributes from SvxBrushItem
            const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
            SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

            setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
            aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
        }
        else
            aBspWin.SetBitmap( NULL );
    }

    pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER );
    aBspWin.setPageFillAttributes(aPageFillAttributes);
    pItem = GetItem(rSet, SID_ATTR_BORDER_OUTER);

    if ( pItem )
        aBspWin.SetBorder( (SvxBoxItem&)*pItem );
    if(pItem)
    {
        aBspWin.SetBorder(static_cast< const SvxBoxItem& >(*pItem));
    }
}

// -----------------------------------------------------------------------
@@ -1387,15 +1433,30 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
            aBspWin.SetHeader( sal_False );

        // im Beispiel Hintergrund und Umrandung anzeigen
        sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;

        if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
        if(mbEnableDrawingLayerFillStyles)
        {
            const SvxBrushItem& rItem =
                (const SvxBrushItem&)rHeaderSet.Get( nWhich );
            aBspWin.SetHdColor( rItem.GetColor() );
            //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
            aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet));
        }
        nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
        else
        {
            const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));

            if(rHeaderSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
            {
                //UUUU aBspWin.SetHdColor(rItem.GetColor());
                const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich));
                SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
            }
        }

        aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
        const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER));

        if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
        {
@@ -1434,15 +1495,30 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
            aBspWin.SetFooter( sal_False );

        // im Beispiel Hintergrund und Umrandung anzeigen
        sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;

        if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
        if(mbEnableDrawingLayerFillStyles)
        {
            const SvxBrushItem& rItem =
                (const SvxBrushItem&)rFooterSet.Get( nWhich );
            aBspWin.SetFtColor( rItem.GetColor() );
            //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
            aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet));
        }
        nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
        else
        {
            const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));

            if(rFooterSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
            {
                //UUUU aBspWin.SetFtColor(rItem.GetColor());
                const SvxBrushItem& rItem = (const SvxBrushItem&)rFooterSet.Get(nWhich);
                SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
            }
        }

        aBspWin.setFooterFillAttributes(aFooterFillAttributes);
        const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER));

        if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
        {
@@ -1703,7 +1779,7 @@ bool SvxPageDescPage::IsPrinterRangeOverflow(
    MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
{
    bool bRet = false;
    bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 );
    bool bCheck = ( ( m_nPos & nPos ) == 0 );
    long nValue = static_cast<long>(rField.GetValue());
    if ( bCheck &&
         (  nValue < nFirstMargin || nValue > nLastMargin ) &&
@@ -1722,53 +1798,74 @@ bool SvxPageDescPage::IsPrinterRangeOverflow(
void SvxPageDescPage::CheckMarginEdits( bool _bClear )
{
    if ( _bClear )
        pImpl->m_nPos = 0;
        m_nPos = 0;

    sal_Int64 nValue = aLeftMarginEdit.GetValue();
    if (  nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
        pImpl->m_nPos |= MARGIN_LEFT;
        m_nPos |= MARGIN_LEFT;
    nValue = aRightMarginEdit.GetValue();
    if (  nValue < nFirstRightMargin || nValue > nLastRightMargin )
        pImpl->m_nPos |= MARGIN_RIGHT;
        m_nPos |= MARGIN_RIGHT;
    nValue = aTopMarginEdit.GetValue();
    if (  nValue < nFirstTopMargin || nValue > nLastTopMargin )
        pImpl->m_nPos |= MARGIN_TOP;
        m_nPos |= MARGIN_TOP;
    nValue = aBottomMarginEdit.GetValue();
    if (  nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
        pImpl->m_nPos |= MARGIN_BOTTOM;
        m_nPos |= MARGIN_BOTTOM;
}

bool SvxPageDescPage::IsMarginOutOfRange()
{
    bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) &&
    bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) &&
                      ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) &&
                    ( aLeftMarginEdit.GetValue() < nFirstLeftMargin ||
                      aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) ||
                  ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) &&
                  ( ( !( m_nPos & MARGIN_RIGHT ) &&
                      ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) &&
                    ( aRightMarginEdit.GetValue() < nFirstRightMargin ||
                      aRightMarginEdit.GetValue() > nLastRightMargin ) ) ||
                  ( ( !( pImpl->m_nPos & MARGIN_TOP ) &&
                  ( ( !( m_nPos & MARGIN_TOP ) &&
                      ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) &&
                    ( aTopMarginEdit.GetValue() < nFirstTopMargin ||
                      aTopMarginEdit.GetValue() > nLastTopMargin ) ) ||
                  ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) &&
                  ( ( !( m_nPos & MARGIN_BOTTOM ) &&
                      ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) &&
                    ( aBottomMarginEdit.GetValue() < nFirstBottomMargin ||
                      aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) );
    return bRet;
}

void SvxPageDescPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
void SvxPageDescPage::PageCreated(SfxAllItemSet aSet) //add CHINA001
{
    SFX_ITEMSET_ARG (&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False);
    SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False);
    SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False);
    SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False);
    if (pModeItem)
    SFX_ITEMSET_ARG(&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False);
    SFX_ITEMSET_ARG(&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False);
    SFX_ITEMSET_ARG(&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False);
    SFX_ITEMSET_ARG(&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False);

    //UUUU
    SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, sal_False);

    if(pModeItem)
    {
        SetMode((SvxModeType)pModeItem->GetEnumValue());
    if (pPaperStartItem && pPaperEndItem)
        SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() );
    if (pCollectListItem)
    }

    if(pPaperStartItem && pPaperEndItem)
    {
        SetPaperFormatRanges((Paper)pPaperStartItem->GetEnumValue(),(Paper)pPaperEndItem->GetEnumValue());
    }

    if(pCollectListItem)
    {
        SetCollectionList(pCollectListItem->GetList());
    }

    if(pSupportDrawingLayerFillStyleItem)
    {
        const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());

        EnableDrawingLayerFillStyles(bNew);
    }
}

//eof
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index f175e25..09d68fe 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -840,8 +840,11 @@ void SvxAreaTabPage::Construct()

void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
{
    sal_uInt16 _nPos = 0;
    sal_uInt16 nCount;
    //UUUU use evtl. previously selected entry to avoid changing values just by
    // switching TabPages in dialogs using this TabPage
    sal_uInt16 _nPos(nPos);
    sal_uInt16 nCount(0);

    //add CHINA001 Begin
    SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
    SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
@@ -2755,6 +2758,7 @@ void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
    SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
    SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
    SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);

    //UUUU
    SFX_ITEMSET_ARG (&aSet, pOfferImportItem, SfxBoolItem, SID_OFFER_IMPORT, sal_False);

diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 882af4c..ec06ee0 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -161,6 +161,22 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
        if (GetLinkManager())
            pDrawLayer->SetLinkManager( pLinkManager );

        //UUUU set DrawingLayer's SfxItemPool at Calc's SfxItemPool as
        // secondary pool to support DrawingLayer FillStyle ranges (and similar)
        // in SfxItemSets using the Calc SfxItemPool. This is e.g. needed when
        // the PageStyle using SvxBrushItem is visualized and will be potentially
        // used more intense in the future
        if(xPoolHelper.isValid())
        {
            ScDocumentPool* pLocalPool = xPoolHelper->GetDocPool();

            if(pLocalPool)
            {
                OSL_ENSURE(!pLocalPool->GetSecondaryPool(), "OOps, already a secondary pool set where the DrawingLayer ItemPool is to be placed (!)");
                pLocalPool->SetSecondaryPool(&pDrawLayer->GetItemPool());
            }
        }

        //  Drawing pages are accessed by table number, so they must also be present
        //  for preceding table numbers, even if the tables aren't allocated
        //  (important for clipboard documents).
@@ -254,7 +270,20 @@ IMPL_LINK_INLINE_END( ScDocument, GetUserDefinedColor, sal_uInt16 *, pColorIndex

void ScDocument::DeleteDrawLayer()
{
    //UUUU remove DrawingLayer's SfxItemPool from Calc's SfxItemPool where
    // it is registered as secondary pool
    if(xPoolHelper.isValid())
    {
        ScDocumentPool* pLocalPool = xPoolHelper->GetDocPool();

        if(pLocalPool && pLocalPool->GetSecondaryPool())
        {
            pLocalPool->SetSecondaryPool(0);
        }
    }

    delete pDrawLayer;
    pDrawLayer = 0;
}

sal_Bool ScDocument::DrawGetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 24bdc0a..36b420e 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -189,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
    svx/source/sdr/animation/scheduler \
    svx/source/sdr/animation/objectanimator \
    svx/source/sdr/animation/animationstate \
    svx/source/sdr/attribute/sdrallfillattributeshelper \
    svx/source/sdr/attribute/sdrlinefillshadowtextattribute \
    svx/source/sdr/attribute/sdrfilltextattribute \
    svx/source/sdr/attribute/sdrshadowtextattribute \
@@ -392,6 +393,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
    svx/source/unodraw/gluepts \
    svx/source/unodraw/shapepropertynotifier \
    svx/source/unodraw/tableshape \
    svx/source/unodraw/unobrushitemhelper \
    svx/source/unodraw/unobtabl \
    svx/source/unodraw/unodtabl \
    svx/source/unodraw/UnoGraphicExporter \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index 632a854..bf583b7 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -204,6 +204,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdprcitm.hxx,svx/sdprcitm.hxx)
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/animationstate.hxx,svx/sdr/animation/animationstate.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/objectanimator.hxx,svx/sdr/animation/objectanimator.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/scheduler.hxx,svx/sdr/animation/scheduler.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrallfillattributeshelper.hxx,svx/sdr/attribute/sdrallfillattributeshelper.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrfilltextattribute.hxx,svx/sdr/attribute/sdrfilltextattribute.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrformtextattribute.hxx,svx/sdr/attribute/sdrformtextattribute.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx,svx/sdr/attribute/sdrformtextoutlineattribute.hxx))
@@ -485,6 +486,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/ucsubset.hrc,svx/ucsubset.hrc)
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ucsubset.hxx,svx/ucsubset.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoapi.hxx,svx/unoapi.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unofill.hxx,svx/unofill.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unobrushitemhelper.hxx,svx/unobrushitemhelper.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomaster.hxx,svx/unomaster.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomid.hxx,svx/unomid.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomod.hxx,svx/unomod.hxx))
diff --git a/svx/inc/svx/hdft.hxx b/svx/inc/svx/hdft.hxx
index 4208efb..307e044 100644
--- a/svx/inc/svx/hdft.hxx
+++ b/svx/inc/svx/hdft.hxx
@@ -43,11 +43,15 @@

// class  SvxHFPage ------------------------------------------------------

class SVX_DLLPUBLIC SvxHFPage: public SfxTabPage
class SVX_DLLPUBLIC SvxHFPage : public SfxTabPage
{
    using TabPage::ActivatePage;
    using TabPage::DeactivatePage;

private:
    //UUUU
    void EnableDrawingLayerFillStyles(bool bNew) { mbEnableDrawingLayerFillStyles = bNew; }

public:

    virtual sal_Bool    FillItemSet( SfxItemSet& rOutSet );
@@ -55,8 +59,12 @@ public:

    virtual         ~SvxHFPage();

    void            DisableDeleteQueryBox() { bDisableQueryBox = sal_True; }
    void            EnableBackgroundSelector( sal_Bool bNew ) { bEnableBackgroundSelector = bNew; }
    void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
    void EnableBackgroundSelector(bool bNew) { mbEnableBackgroundSelector = bNew; }

    //UUUU
    virtual void PageCreated(SfxAllItemSet aSet);

    void            EnableDynamicSpacing();

protected:
@@ -84,9 +92,11 @@ protected:

    sal_uInt16          nId;
    SfxItemSet*     pBBSet;
    sal_Bool            bDisableQueryBox;
    sal_Bool            bEnableBackgroundSelector;
    FASTBOOL        bInReset;

    /// bitfield
    bool            mbDisableQueryBox : 1;
    bool            mbEnableBackgroundSelector : 1;
    bool            mbEnableDrawingLayerFillStyles : 1;

    void            InitHandler();
    DECL_LINK( TurnOnHdl, CheckBox*);
diff --git a/svx/inc/svx/pagectrl.hxx b/svx/inc/svx/pagectrl.hxx
index 471b72c..df3e758 100644
--- a/svx/inc/svx/pagectrl.hxx
+++ b/svx/inc/svx/pagectrl.hxx
@@ -19,19 +19,14 @@
 *
 *************************************************************/


#ifndef _SVX_PAGECTRL_HXX
#define _SVX_PAGECTRL_HXX

// include ---------------------------------------------------------------

#include <vcl/window.hxx>
#include "svx/svxdllapi.h"

// forward ---------------------------------------------------------------
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>

class SvxBoxItem;
struct PageWindow_Impl;

// class SvxPageWindow ---------------------------------------------------

@@ -47,29 +42,34 @@ private:
    long        nBottom;
    long        nLeft;
    long        nRight;
    Color       aColor;

    PageWindow_Impl* pImpl;
    SvxBoxItem*     pBorder;
    sal_Bool        bResetBackground;
    sal_Bool        bFrameDirection;
    sal_Int32       nFrameDirection;

    long        nHdLeft;
    long        nHdRight;
    long        nHdDist;
    long        nHdHeight;
    Color       aHdColor;
    SvxBoxItem* pHdBorder;

    long        nFtLeft;
    long        nFtRight;
    long        nFtDist;
    long        nFtHeight;
    Color       aFtColor;
    SvxBoxItem* pFtBorder;

    sal_Bool        bFooter :1;
    sal_Bool        bHeader :1;
    sal_Bool        bTable  :1;
    sal_Bool        bHorz   :1;
    sal_Bool        bVert   :1;
    //UUUU
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maHeaderFillAttributes;
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maFooterFillAttributes;
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maPageFillAttributes;

    sal_Bool        bFooter : 1;
    sal_Bool        bHeader : 1;
    sal_Bool        bTable : 1;
    sal_Bool        bHorz : 1;
    sal_Bool        bVert : 1;

    sal_uInt16      eUsage;

@@ -77,90 +77,95 @@ private:
    String      aRightText;

protected:
    virtual void Paint( const Rectangle& rRect );
    virtual void Paint(const Rectangle& rRect);

    virtual void DrawPage( const Point& rPoint,
                           const sal_Bool bSecond,
                           const sal_Bool bEnabled );
    virtual void DrawPage(const Point& rPoint,
        const sal_Bool bSecond,
        const sal_Bool bEnabled);

    //UUUU
    void drawFillAttributes(
        const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
        const Rectangle& rPaintRange,
        const Rectangle& rDefineRange);

public:
    SvxPageWindow( Window* pParent, const ResId& rId );
    SvxPageWindow(Window* pParent,const ResId& rId);
    ~SvxPageWindow();

    void        SetWidth( long nW )                     { aSize.Width()  = nW; }
    void        SetHeight( long nH )                    { aSize.Height() = nH; }
    //UUUU
    void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; }
    void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maFooterFillAttributes = rFillAttributes; }
    void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maPageFillAttributes = rFillAttributes; }
    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const { return maPageFillAttributes; }

    void        SetSize( const Size& rSz )              { aSize = rSz; }
    void        SetWidth(long nW)                       { aSize.Width() = nW; }
    void        SetHeight(long nH)                  { aSize.Height() = nH; }

    void        SetSize(const Size& rSz)                { aSize = rSz; }
    const Size& GetSize() const                         { return aSize; }

    void        SetTop( long nNew )                     { nTop = nNew; }
    void        SetBottom( long nNew )                  { nBottom = nNew; }
    void        SetLeft( long nNew )                    { nLeft = nNew; }
    void        SetRight( long nNew )                   { nRight = nNew; }
    void        SetColor( const Color& rNew )           { aColor = rNew; }
    void        SetBorder( const SvxBoxItem& rNew );
    void        SetBitmap( Bitmap* pBmp );
    void        SetTop(long nNew)                       { nTop = nNew; }
    void        SetBottom(long nNew)                    { nBottom = nNew; }
    void        SetLeft(long nNew)                  { nLeft = nNew; }
    void        SetRight(long nNew)                 { nRight = nNew; }
    void        SetBorder(const SvxBoxItem& rNew);

    long        GetTop() const                          { return nTop;   }
    long        GetBottom() const                       { return nBottom;}
    long        GetLeft() const                         { return nLeft;  }
    long        GetTop() const                          { return nTop; }
    long        GetBottom() const                       { return nBottom; }
    long        GetLeft() const                         { return nLeft; }
    long        GetRight() const                        { return nRight; }

    const Color&        GetColor() const                { return aColor; }
    const SvxBoxItem&   GetBorder() const;

    void        SetHdLeft( long nNew )                  { nHdLeft = nNew; }
    void        SetHdRight( long nNew )                 { nHdRight = nNew; }
    void        SetHdDist( long nNew )                  { nHdDist = nNew; }
    void        SetHdHeight( long nNew )                { nHdHeight = nNew; }
    void        SetHdColor( const Color& aNew )         { aHdColor = aNew; }
    void        SetHdBorder( const SvxBoxItem& rNew );
    void        SetHdLeft(long nNew)                    { nHdLeft = nNew; }
    void        SetHdRight(long nNew)                   { nHdRight = nNew; }
    void        SetHdDist(long nNew)                    { nHdDist = nNew; }
    void        SetHdHeight(long nNew)              { nHdHeight = nNew; }
    void        SetHdBorder(const SvxBoxItem& rNew);

    long        GetHdLeft() const                       { return nHdLeft;  }
    long        GetHdLeft() const                       { return nHdLeft; }
    long        GetHdRight() const                      { return nHdRight; }
    long        GetHdDist() const                       { return nHdDist;  }
    long        GetHdHeight() const                     { return nHdHeight;}
    long        GetHdDist() const                       { return nHdDist; }
    long        GetHdHeight() const                     { return nHdHeight; }

    const Color&        GetHdColor() const              { return aHdColor; }
    const SvxBoxItem&   GetHdBorder() const             { return *pHdBorder; }

    void        SetFtLeft( long nNew )                  { nFtLeft = nNew; }
    void        SetFtRight( long nNew )                 { nFtRight = nNew; }
    void        SetFtDist( long nNew )                  { nFtDist = nNew; }
    void        SetFtHeight( long nNew )                { nFtHeight = nNew; }
    void        SetFtColor( const Color& aNew )         { aFtColor = aNew; }
    void        SetFtBorder( const SvxBoxItem& rNew );
    void        SetFtLeft(long nNew)                    { nFtLeft = nNew; }
    void        SetFtRight(long nNew)                   { nFtRight = nNew; }
    void        SetFtDist(long nNew)                    { nFtDist = nNew; }
    void        SetFtHeight(long nNew)              { nFtHeight = nNew; }
    void        SetFtBorder(const SvxBoxItem& rNew);

    long        GetFtLeft() const                       { return nFtLeft;  }
    long        GetFtLeft() const                       { return nFtLeft; }
    long        GetFtRight() const                      { return nFtRight; }
    long        GetFtDist() const                       { return nFtDist;  }
    long        GetFtHeight() const                     { return nFtHeight;}
    long        GetFtDist() const                       { return nFtDist; }
    long        GetFtHeight() const                     { return nFtHeight; }

    const Color&        GetFtColor() const              { return aFtColor; }
    const SvxBoxItem&   GetFtBorder() const             { return *pFtBorder; }

    void        SetUsage( sal_uInt16 eU )                   { eUsage = eU;  }
    sal_uInt16      GetUsage() const                        { return eUsage;}
    void        SetUsage(sal_uInt16 eU)                 { eUsage = eU; }
    sal_uInt16      GetUsage() const                        { return eUsage; }

    void        SetHeader( sal_Bool bNew )                  { bHeader = bNew; }
    sal_Bool        GetHeader() const                       { return bHeader;}
    void        SetFooter( sal_Bool bNew )                  { bFooter = bNew; }
    sal_Bool        GetFooter() const                       { return bFooter;}
    void        SetHeader(sal_Bool bNew)                { bHeader = bNew; }
    sal_Bool        GetHeader() const                       { return bHeader; }
    void        SetFooter(sal_Bool bNew)                    { bFooter = bNew; }
    sal_Bool        GetFooter() const                       { return bFooter; }

    void        SetTable( sal_Bool bNew )                   { bTable = bNew; }
    sal_Bool        GetTable() const                        { return bTable;}
    void        SetHorz( sal_Bool bNew )                    { bHorz = bNew; }
    sal_Bool        GetHorz() const                         { return bHorz;}
    void        SetVert( sal_Bool bNew )                    { bVert = bNew; }
    sal_Bool        GetVert() const                         { return bVert;}
    void        SetTable(sal_Bool bNew)                 { bTable = bNew; }
    sal_Bool        GetTable() const                        { return bTable; }
    void        SetHorz(sal_Bool bNew)                  { bHorz = bNew; }
    sal_Bool        GetHorz() const                         { return bHorz; }
    void        SetVert(sal_Bool bNew)                  { bVert = bNew; }
    sal_Bool        GetVert() const                         { return bVert; }

    void        EnableFrameDirection(sal_Bool bEnable);
    //uses enum SvxFrameDirection
    void        SetFrameDirection(sal_Int32 nFrameDirection);
    void        SetFrameDirection(sal_Int32 nDirection);

    void        ResetBackground();
};

#endif // #ifndef _SVX_PAGECTRL_HXX


//eof
diff --git a/svx/inc/svx/sdr/attribute/sdrallfillattributeshelper.hxx b/svx/inc/svx/sdr/attribute/sdrallfillattributeshelper.hxx
new file mode 100755
index 0000000..3983db2
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrallfillattributeshelper.hxx
@@ -0,0 +1,98 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
#define _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX

#include "svx/svxdllapi.h"
#include <drawinglayer/attribute/fillgradientattribute.hxx>
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <boost/shared_ptr.hpp>
#include <tools/color.hxx>
#include <svl/itemset.hxx>

//////////////////////////////////////////////////////////////////////////////

namespace drawinglayer
{
    namespace attribute
    {
        class SVX_DLLPUBLIC SdrAllFillAttributesHelper
        {
        private:
            basegfx::B2DRange                                                   maLastPaintRange;
            basegfx::B2DRange                                                   maLastDefineRange;
            boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute >      maFillAttribute;
            boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > maFillGradientAttribute;
            drawinglayer::primitive2d::Primitive2DSequence                      maPrimitives;

            void createPrimitive2DSequence(
                const basegfx::B2DRange& rPaintRange,
                const basegfx::B2DRange& rDefineRange);

        protected:
        public:
            SdrAllFillAttributesHelper();
            SdrAllFillAttributesHelper(const Color& rColor);
            SdrAllFillAttributesHelper(const SfxItemSet& rSet);
            ~SdrAllFillAttributesHelper();

            bool isUsed() const;
            bool hasSdrFillAttribute() const { return maFillAttribute.get(); }
            bool hasFillGradientAttribute() const { return maFillGradientAttribute.get(); }
            bool isTransparent() const;

            const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
            const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const;
            const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence(
                const basegfx::B2DRange& rPaintRange,
                const basegfx::B2DRange& rDefineRange) const;

            // get average fill color; tries to calculate a 'medium' color
            // which e.g. may be used as comparison to decide if other
            // colors are visible
            basegfx::BColor getAverageColor(const basegfx::BColor& rFallback) const;

            // return if a repaint of this content needs a complete repaint. This
            // is e.g. not needed for no fill or color fill (a partial repaint
            // will do the trick), but necessary for everything that is not top-left
            // oriented
            bool needCompleteRepaint() const;
        };
    } // end of namespace attribute
} // end of namespace drawinglayer

//////////////////////////////////////////////////////////////////////////////

namespace drawinglayer
{
    namespace attribute
    {
        typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
    } // end of namespace attribute
} // end of namespace drawinglayer

//////////////////////////////////////////////////////////////////////////////

#endif // _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX

// eof
diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx
index bea905e..55589a2 100644
--- a/svx/inc/svx/svxdlg.hxx
+++ b/svx/inc/svx/svxdlg.hxx
@@ -385,9 +385,14 @@ public:
                                                            sal_uInt16 nOther,
                                                            sal_uInt16 nShorter,
                                                            sal_uInt16 nLonger ) = 0;
    virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, //add for SvxBorderBackgroundDlg
                                            const SfxItemSet& rCoreSet,
                                            sal_Bool bEnableSelector = sal_False) = 0;

    //UUUU add for SvxBorderBackgroundDlg
    virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg(
        Window* pParent,
        const SfxItemSet& rCoreSet,
        bool bEnableSelector = false,
        bool bEnableDrawingLayerFillStyles = false) = 0;

    virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, //add for SvxTransformTabDialog
                                                                const SfxItemSet* pAttr,
                                                                const SdrView* pView,
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 67b145f..f48c4ff 100755
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -1347,9 +1347,10 @@

//UUUU
#define SID_OFFER_IMPORT                                ( SID_SVX_START + 1119)
#define SID_DRAWINGLAYER_FILLSTYLES                     ( SID_SVX_START + 1120)

// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE                               (SID_OFFER_IMPORT + 1)
#define SID_SVX_FIRSTFREE                               (SID_DRAWINGLAYER_FILLSTYLES + 1)

// --------------------------------------------------------------------------
// Overflow check for slot IDs
diff --git a/svx/inc/svx/unobrushitemhelper.hxx b/svx/inc/svx/unobrushitemhelper.hxx
new file mode 100644
index 0000000..a943d4c
--- /dev/null
+++ b/svx/inc/svx/unobrushitemhelper.hxx
@@ -0,0 +1,56 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef _UNOBRUSHITEMHELPER_HXX
#define _UNOBRUSHITEMHELPER_HXX

#include "svx/svxdllapi.h"
#include <editeng/brshitem.hxx>

//UUUU Helper function definintions for UNO API fallbacks to replace SvxBrushItem. The
// idea is to have fallbacks to create a SvxBrushItem if needed for backwards compatibility
// if needed from the SfxItemSet and vice versa. This is used in cases where e.g. UNO API
// accesses to slots in the SvxBrushItem are used (see cases in SvxBrushItem::QueryValue
// and SvxBrushItem::PutValue as MID_BACK_COLOR and similar).
// To make this work, a cycle of creating a SvxBrushItem from a SfxItemSet, changing a value
// using PutValue, putting back to the SfxItemSet should create the *same* SvxBrushItem
// the next time this will be created using getSvxBrushItemFromSourceSet. For more details,
// see comments at the implementations of that two methods.

// Set the equivalent in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST] in the given
// SfxItemSet to create the same FillStyle as is expressed by the given SvxBrushItem.
// This method will reset all items in the XATTR_FILL_* range first.
void SVX_DLLPUBLIC setSvxBrushItemAsFillAttributesToTargetSet(
    const SvxBrushItem& rBrush,
    SfxItemSet& rToSet);

// Create a SvxBrushItem as close as possible to the settings in the DrawingLayer
// items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100%
// representable this may lead to reduced data. With nBackgroundID a Which-ID for the
// to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND).
SvxBrushItem SVX_DLLPUBLIC getSvxBrushItemFromSourceSet(
    const SfxItemSet& rSourceSet,
    sal_uInt16 nBackgroundID,
    sal_Bool bSearchInParents = sal_True);

#endif // _UNOBRUSHITEMHELPER_HXX

//eof
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 8b0350f..a7b506ae 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -19,12 +19,9 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"

// include ---------------------------------------------------------------
#include <tools/shl.hxx>
#include <svl/itemiter.hxx>
#include <sfx2/app.hxx>
@@ -32,31 +29,33 @@
#include <sfx2/module.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/graph.hxx>

#include <sfx2/sfxsids.hrc>
#include <svx/svxids.hrc>
#include <svx/dialogs.hrc>
#include "hdft.hrc"
#include <svl/intitem.hxx>

#define _SVX_HDFT_CXX

#include <svx/hdft.hxx>
#include <svx/pageitem.hxx>
//CHINA001 #include "bbdlg.hxx"
#include "svx/dlgutil.hxx"
#include <svx/dialmgr.hxx>
#include "svx/htmlmode.hxx"

#include <editeng/brshitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/shaditem.hxx>
#include <editeng/sizeitem.hxx>
#include <editeng/boxitem.hxx>

#include <svx/svxdlg.hxx> //CHINA001
#include <svx/dialogs.hrc> //CHINA001

//UUUU
#include <svx/xdef.hxx>
#include <svx/xenum.hxx>
#include <svx/xfillit0.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <sfx2/request.hxx>

// static ----------------------------------------------------------------

// --> OD 2004-06-18 #i19922#
@@ -70,6 +69,11 @@ static const long DEF_DIST_CALC = 250;      // 2,5mm (Calc)
static sal_uInt16 pRanges[] =
{
    SID_ATTR_BRUSH,          SID_ATTR_BRUSH,

    //UUUU Support DrawingLayer FillStyles (no real call to below GetRanges()
    // detected, still do the complete transition)
    XATTR_FILL_FIRST,        XATTR_FILL_LAST,

    SID_ATTR_BORDER_OUTER,   SID_ATTR_BORDER_OUTER,
    SID_ATTR_BORDER_INNER,   SID_ATTR_BORDER_INNER,
    SID_ATTR_BORDER_SHADOW,  SID_ATTR_BORDER_SHADOW,
@@ -138,9 +142,8 @@ SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :

// -----------------------------------------------------------------------

SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) :

    SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),
SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId )
:   SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),

    aFrm            ( this, SVX_RES( FL_FRAME ) ),
    aTurnOnBox      ( this, SVX_RES( CB_TURNON ) ),
@@ -158,11 +161,13 @@ SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAtt
    aBspWin         ( this, SVX_RES( WN_BSP ) ),
    aBackgroundBtn  ( this, SVX_RES( BTN_EXTRAS ) ),

    nId                         ( nSetId ),
    pBBSet                      ( NULL ),
    bDisableQueryBox            ( sal_False ),
    bEnableBackgroundSelector   ( sal_True )
    nId             ( nSetId ),
    pBBSet          ( NULL ),

    // bitfield
    mbDisableQueryBox(false),
    mbEnableBackgroundSelector(true),
    mbEnableDrawingLayerFillStyles(false)
{
    InitHandler();
    aBspWin.EnableRTL( sal_False );
@@ -205,34 +210,49 @@ SvxHFPage::~SvxHFPage()

sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
{
    const sal_uInt16        nWSize      = GetWhich( SID_ATTR_PAGE_SIZE );
    const sal_uInt16        nWLRSpace   = GetWhich( SID_ATTR_LRSPACE );
    const sal_uInt16        nWULSpace   = GetWhich( SID_ATTR_ULSPACE );
    const sal_uInt16        nWOn        = GetWhich( SID_ATTR_PAGE_ON );
    const sal_uInt16        nWDynamic   = GetWhich( SID_ATTR_PAGE_DYNAMIC );
    const sal_uInt16        nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING );
    const sal_uInt16        nWShared    = GetWhich( SID_ATTR_PAGE_SHARED );
    const sal_uInt16        nWBrush     = GetWhich( SID_ATTR_BRUSH );
    const sal_uInt16        nWBox       = GetWhich( SID_ATTR_BORDER_OUTER );
    const sal_uInt16        nWBoxInfo   = GetWhich( SID_ATTR_BORDER_INNER );
    const sal_uInt16        nWShadow    = GetWhich( SID_ATTR_BORDER_SHADOW );
    const sal_uInt16        aWhichTab[] = { nWSize,     nWSize,
                                        nWLRSpace,  nWLRSpace,
                                        nWULSpace,  nWULSpace,
                                        nWOn,       nWOn,
                                        nWDynamic,  nWDynamic,
                                        nWShared,   nWShared,
                                        nWBrush,    nWBrush,
                                        nWBoxInfo,  nWBoxInfo,
                                        nWBox,      nWBox,
                                        nWShadow,   nWShadow,
                                        nWDynSpacing, nWDynSpacing,
                                        0 };
    const SfxItemSet&   rOldSet     = GetItemSet();
    SfxItemPool*        pPool       = rOldSet.GetPool();
    DBG_ASSERT( pPool, "no pool :-(" );
    SfxMapUnit          eUnit       = pPool->GetMetric( nWSize );
    SfxItemSet          aSet        ( *pPool, aWhichTab );
    const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE);
    const sal_uInt16 nWLRSpace = GetWhich(SID_ATTR_LRSPACE);
    const sal_uInt16 nWULSpace = GetWhich(SID_ATTR_ULSPACE);
    const sal_uInt16 nWOn = GetWhich(SID_ATTR_PAGE_ON);
    const sal_uInt16 nWDynamic = GetWhich(SID_ATTR_PAGE_DYNAMIC);
    const sal_uInt16 nWDynSpacing = GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING);
    const sal_uInt16 nWShared = GetWhich(SID_ATTR_PAGE_SHARED);
    const sal_uInt16 nWBrush = GetWhich(SID_ATTR_BRUSH);
    const sal_uInt16 nWBox = GetWhich(SID_ATTR_BORDER_OUTER);
    const sal_uInt16 nWBoxInfo = GetWhich(SID_ATTR_BORDER_INNER);
    const sal_uInt16 nWShadow = GetWhich(SID_ATTR_BORDER_SHADOW);

    const sal_uInt16 aWhichTab[] = {
        nWSize, nWSize,
        nWLRSpace, nWLRSpace,
        nWULSpace, nWULSpace,
        nWOn, nWOn,
        nWDynamic, nWDynamic,
        nWShared, nWShared,
        nWBrush, nWBrush,
        nWBoxInfo, nWBoxInfo,
        nWBox, nWBox,
        nWShadow, nWShadow,
        nWDynSpacing, nWDynSpacing,

        //UUUU take over DrawingLayer FillStyles
        XATTR_FILL_FIRST, XATTR_FILL_LAST,                // [1014

        0, 0};

    const SfxItemSet& rOldSet = GetItemSet();
    SfxItemPool* pPool = rOldSet.GetPool();
    DBG_ASSERT(pPool,"no pool :-(");
    SfxMapUnit eUnit = pPool->GetMetric(nWSize);
    SfxItemSet aSet(*pPool,aWhichTab);

    if(mbEnableDrawingLayerFillStyles)
    {
        //UUUU When using the XATTR_FILLSTYLE DrawingLayer FillStyle definition
        // extra action has to be done here since the pool default is XFILL_SOLID
        // instead of XFILL_NONE (to have the default blue fill color at start).
        aSet.Put(XFillStyleItem(XFILL_NONE));
    }

    //--------------------------------------------------------------------

@@ -274,26 +294,47 @@ sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
    aSet.Put( aUL );

    // Hintergrund und Umrandung?
    if ( pBBSet )
        aSet.Put( *pBBSet );
    if(pBBSet)
    {
        aSet.Put(*pBBSet);
    }
    else
    {
        const SfxItemSet* _pSet;
        const SfxPoolItem* pItem;

        if ( SFX_ITEM_SET ==
             GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
        if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem))
        {
            _pSet = &( (SvxSetItem*)pItem )->GetItemSet();
            _pSet = &(static_cast< const SvxSetItem* >(pItem)->GetItemSet());

            if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
                aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) );
            if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET )
                aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) );
            if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET )
                aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) );
            if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET )
                aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) );
            if(_pSet->GetItemState(nWBrush) == SFX_ITEM_SET)
            {
                aSet.Put(_pSet->Get(nWBrush));
            }

            if(_pSet->GetItemState(nWBoxInfo) == SFX_ITEM_SET)
            {
                aSet.Put(_pSet->Get(nWBoxInfo));
            }

            if(_pSet->GetItemState(nWBox) == SFX_ITEM_SET)
            {
                aSet.Put(_pSet->Get(nWBox));
            }

            if(_pSet->GetItemState(nWShadow) == SFX_ITEM_SET)
            {
                aSet.Put(_pSet->Get(nWShadow));
            }

            //UUUU take care of [XATTR_XATTR_FILL_FIRST .. XATTR_FILL_LAST]
            for(sal_uInt16 nFillStyleId(XATTR_FILL_FIRST); nFillStyleId <= XATTR_FILL_LAST; nFillStyleId++)
            {
                if(_pSet->GetItemState(nFillStyleId) == SFX_ITEM_SET)
                {
                    aSet.Put(_pSet->Get(nFillStyleId));
                }
            }
        }
    }

@@ -466,7 +507,7 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
    {
        sal_Bool bDelete = sal_True;

        if ( !bDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
        if ( !mbDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
            bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );

        if ( bDelete )
@@ -529,80 +570,169 @@ IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG )

IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG )
{
    if ( !pBBSet )
    if(!pBBSet)
    {
        // nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen
        sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH );
        sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER );
        sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
        sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
        const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER));
        const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, sal_False));
        const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW));

        // einen leeren Set erzeugenc
        pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush,
                                 nOuter, nOuter, nInner, nInner,
                                 nShadow, nShadow, 0 );
        if(mbEnableDrawingLayerFillStyles)
        {
            pBBSet = new SfxItemSet(
                *GetItemSet().GetPool(),
                XATTR_FILL_FIRST, XATTR_FILL_LAST,  // DrawingLayer FillStyle definitions
                SID_COLOR_TABLE, SID_BITMAP_LIST,   // XPropertyLists for Color, Gradient, Hatch and Graphic fills
                nOuter, nOuter,
                nInner, nInner,
                nShadow, nShadow,
                0, 0);

            //UUUU copy items for XPropertyList entries from the DrawModel so that
            // the Area TabPage can access them
            static const sal_uInt16 nCopyFlags[] = {
                SID_COLOR_TABLE,
                SID_GRADIENT_LIST,
                SID_HATCH_LIST,
                SID_BITMAP_LIST,
                0
            };

            for(sal_uInt16 a(0); nCopyFlags[a]; a++)
            {
                const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]);

                if(pItem)
                {
                    pBBSet->Put(*pItem);
                }
                else
                {
                    OSL_ENSURE(false, "XPropertyList missing (!)");
                }
            }
        }
        else
        {
            const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH));

            pBBSet = new SfxItemSet(
                *GetItemSet().GetPool(),
                nBrush, nBrush,
                nOuter, nOuter,
                nInner, nInner,
                nShadow, nShadow,
                0, 0);
        }

        const SfxPoolItem* pItem;

        if ( SFX_ITEM_SET ==
             GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
            // wenn es schon einen gesetzen Set gibt, dann diesen benutzen
            pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() );
        if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem))
        {
            // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or
            // SID_ATTR_PAGE_FOOTERSET exists, use it's content
            pBBSet->Put(((SvxSetItem*)pItem)->GetItemSet());
        }
        else
        {
            if(mbEnableDrawingLayerFillStyles)
            {
                //UUUU The style for header/footer is not yet created, need to reset
                // XFillStyleItem to XFILL_NONE which is the same as in the style
                // initialization. This needs to be done since the pool default for
                // XFillStyleItem is XFILL_SOLID
                pBBSet->Put(XFillStyleItem(XFILL_NONE));
            }
        }

        if ( SFX_ITEM_SET ==
             GetItemSet().GetItemState( nInner, sal_False, &pItem ) )
        if(SFX_ITEM_SET == GetItemSet().GetItemState(nInner, sal_False, &pItem))
        {
            // das gesetze InfoItem wird immer ben"otigt
            pBBSet->Put( *pItem );
            pBBSet->Put(*pItem);
        }
    }

    //CHINA001 SvxBorderBackgroundDlg* pDlg =
//CHINA001      new SvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();

    if(pFact)
    {
        SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
        DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
        if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
        //UUUU
        SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg(
            this,
            *pBBSet,
            mbEnableBackgroundSelector,
            mbEnableDrawingLayerFillStyles);

        DBG_ASSERT(pDlg,"Dialogdiet fail!");//CHINA001
        if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet())
        {
            SfxItemIter aIter( *pDlg->GetOutputItemSet() );
            SfxItemIter aIter(*pDlg->GetOutputItemSet());
            const SfxPoolItem* pItem = aIter.FirstItem();

            while ( pItem )
            while(pItem)
            {
                if ( !IsInvalidItem( pItem ) )
                    pBBSet->Put( *pItem );
                if(!IsInvalidItem(pItem))
                {
                    pBBSet->Put(*pItem);
                }

                pItem = aIter.NextItem();
            }

            //----------------------------------------------------------------

            sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );

            if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
            {
                const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich );
                if ( nId == SID_ATTR_PAGE_HEADERSET )
                    aBspWin.SetHdColor( rItem.GetColor() );
                drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

                if(mbEnableDrawingLayerFillStyles)
                {
                    //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
                    aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet));
                }
                else
                    aBspWin.SetFtColor( rItem.GetColor() );
                {
                    const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);

                    if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET)
                    {
                        //UUUU create FillAttributes from SvxBrushItem
                        const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich));
                        SfxItemSet aTempSet(*pBBSet->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                        setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                        aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
                    }
                }

                if(SID_ATTR_PAGE_HEADERSET == nId)
                {
                    //aBspWin.SetHdColor(rItem.GetColor());
                    aBspWin.setHeaderFillAttributes(aFillAttributes);
                }
                else
                {
                    //aBspWin.SetFtColor(rItem.GetColor());
                    aBspWin.setFooterFillAttributes(aFillAttributes);
                }
            }

            //----------------------------------------------------------------

            nWhich = GetWhich( SID_ATTR_BORDER_OUTER );

            if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
            {
                const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich );
                const sal_uInt16 nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

                if ( nId == SID_ATTR_PAGE_HEADERSET )
                    aBspWin.SetHdBorder( rItem );
                else
                    aBspWin.SetFtBorder( rItem );
                if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET)
                {
                    const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get(nWhich);

                    if(nId == SID_ATTR_PAGE_HEADERSET)
                        aBspWin.SetHdBorder(rItem);
                    else
                        aBspWin.SetFtBorder(rItem);
                }
            }

            UpdateExample();
        }
    delete pDlg;
        delete pDlg;
    }
    return 0;
}
@@ -638,87 +768,122 @@ void SvxHFPage::UpdateExample()

void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
{
    sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
    sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));

    if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
    {
        const SvxSetItem& rSetItem =
            (const SvxSetItem&)rSet.Get( nWhich, sal_False );
        const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
        const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
        const SfxBoolItem& rOn =
            (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
        const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));

        if ( rOn.GetValue() )
        if(rOn.GetValue())
        {
            nWhich = GetWhich( SID_ATTR_BRUSH );
            drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            if(mbEnableDrawingLayerFillStyles)
            {
                const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
                aBspWin.SetHdColor( rItem.GetColor() );
                //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
                aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
            }
            nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
            else
            {
                nWhich = GetWhich(SID_ATTR_BRUSH);

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
                if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
                {
                    //UUUU create FillAttributes from SvxBrushItem
                    const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
                    SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                    setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                    aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
                }
            }

            aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
            nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

            if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
            {
                const SvxBoxItem& rItem =
                    (const SvxBoxItem&)rTmpSet.Get( nWhich );
                aBspWin.SetHdBorder( rItem );
                    (const SvxBoxItem&)rTmpSet.Get(nWhich);
                aBspWin.SetHdBorder(rItem);
            }
        }
    }

    nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
    nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);

    if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
    {
        const SvxSetItem& rSetItem =
            (const SvxSetItem&)rSet.Get( nWhich, sal_False );
        const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
        const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
        const SfxBoolItem& rOn =
            (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
        const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));

        if ( rOn.GetValue() )
        if(rOn.GetValue())
        {
            nWhich = GetWhich( SID_ATTR_BRUSH );
            drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            if(mbEnableDrawingLayerFillStyles)
            {
                const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
                aBspWin.SetFtColor( rItem.GetColor() );
                //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
                aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
            }
            nWhich = GetWhich( SID_ATTR_BORDER_OUTER );

            if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
            else
            {
                const SvxBoxItem& rItem =
                    (const SvxBoxItem&)rTmpSet.Get( nWhich );
                aBspWin.SetFtBorder( rItem );
                nWhich = GetWhich(SID_ATTR_BRUSH);

                if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
                {
                    //UUUU create FillAttributes from SvxBrushItem
                    const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
                    SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                    setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                    aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
                }
            }

            aBspWin.setFooterFillAttributes(aFooterFillAttributes);
            nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

            if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
            {
                const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
                aBspWin.SetFtBorder(rItem);
            }
        }
    }
    nWhich = GetWhich( SID_ATTR_BRUSH );

    if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;

    if(mbEnableDrawingLayerFillStyles)
    {
        const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich );
        aBspWin.SetColor( rItem.GetColor() );
        const Graphic* pGrf = rItem.GetGraphic();

        if ( pGrf )
        {
            Bitmap aBitmap = pGrf->GetBitmap();
            aBspWin.SetBitmap( &aBitmap );
        }
        else
            aBspWin.SetBitmap( NULL );
        //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
        aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
    }
    nWhich = GetWhich( SID_ATTR_BORDER_OUTER );

    if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    else
    {
        const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich );
        aBspWin.SetBorder( rItem );
        nWhich = GetWhich(SID_ATTR_BRUSH);

        if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
        {
            //UUUU create FillAttributes from SvxBrushItem
            const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich));
            SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

            setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
            aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
        }
    }

    aBspWin.setPageFillAttributes(aPageFillAttributes);
    nWhich = GetWhich(SID_ATTR_BORDER_OUTER);

    if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
    {
        const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rSet.Get(nWhich));
        aBspWin.SetBorder(rItem);
    }
}

@@ -973,6 +1138,7 @@ void lcl_Move(Window& rWin, sal_Int32 nDiff)
    aPos.Y() -= nDiff;
    rWin.SetPosPixel(aPos);
}

void SvxHFPage::EnableDynamicSpacing()
{
    aDynSpacingCB.Show();
@@ -991,3 +1157,17 @@ void SvxHFPage::EnableDynamicSpacing()
        lcl_Move(*aMoveWindows[nIdx++], nOffset);
}

void SvxHFPage::PageCreated(SfxAllItemSet aSet)
{
    //UUUU
    SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, sal_False);

    if(pSupportDrawingLayerFillStyleItem)
    {
        const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());

        EnableDrawingLayerFillStyles(bNew);
    }
}

//eof
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 0917aa0..745d05c 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -19,45 +19,20 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"

// include ---------------------------------------------------------------


#include <vcl/bitmap.hxx>
#include <editeng/frmdiritem.hxx>
#include <svx/pageitem.hxx>
#include <svx/pagectrl.hxx>
#include <editeng/boxitem.hxx>

#include <algorithm>

// struct PageWindow_Impl ------------------------------------------------

struct PageWindow_Impl
{
    SvxBoxItem*     pBorder;
    Bitmap          aBitmap;
    FASTBOOL        bBitmap;
    sal_Bool        bResetBackground;
    sal_Bool        bFrameDirection;
    sal_Int32       nFrameDirection;


    PageWindow_Impl() :
        pBorder(0),
        bBitmap(sal_False),
        bResetBackground(sal_False),
        bFrameDirection(sal_False),
        nFrameDirection(0) {}

    void        EnableFrameDirection(sal_Bool bEnable){bFrameDirection = bEnable;}
    void        SetFrameDirection(sal_Int32 nDirection){nFrameDirection = nDirection;}

};
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>

// STATIC DATA -----------------------------------------------------------

@@ -66,44 +41,57 @@ struct PageWindow_Impl

// class SvxPageWindow ---------------------------------------------------

SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) :
SvxPageWindow::SvxPageWindow(Window* pParent,const ResId& rId)
: Window(pParent,rId),
    aWinSize(),
    aSize(),

    Window( pParent, rId ),
    nTop(0),
    nBottom(0),
    nLeft(0),
    nRight(0),

    nTop        ( 0 ),
    nBottom     ( 0 ),
    nLeft       ( 0 ),
    nRight      ( 0 ),
    aColor      ( COL_TRANSPARENT ),
    nHdLeft     ( 0 ),
    nHdRight    ( 0 ),
    nHdDist     ( 0 ),
    nHdHeight   ( 0 ),
    aHdColor    ( COL_TRANSPARENT ),
    pHdBorder   ( 0 ),
    nFtLeft     ( 0 ),
    nFtRight    ( 0 ),
    nFtDist     ( 0 ),
    nFtHeight   ( 0 ),
    aFtColor    ( COL_TRANSPARENT ),
    pFtBorder   ( 0 ),
    bFooter     ( sal_False ),
    bHeader     ( sal_False ),
    bTable      ( sal_False ),
    bHorz       ( sal_False ),
    bVert       ( sal_False ),
    eUsage      ( SVX_PAGE_ALL )
    //UUUU
    pBorder(0),
    bResetBackground(sal_False),
    bFrameDirection(sal_False),
    nFrameDirection(0),

    nHdLeft(0),
    nHdRight(0),
    nHdDist(0),
    nHdHeight(0),

    pHdBorder(0),
    nFtLeft(0),
    nFtRight(0),
    nFtDist(0),
    nFtHeight(0),

    pFtBorder(0),

    maHeaderFillAttributes(),
    maFooterFillAttributes(),
    maPageFillAttributes(),

    bFooter(sal_False),
    bHeader(sal_False),
    bTable(sal_False),
    bHorz(sal_False),
    bVert(sal_False),
    eUsage(SVX_PAGE_ALL),

    aLeftText(),
    aRightText()

{
    pImpl = new PageWindow_Impl;

    // defaultmaessing in Twips rechnen
    SetMapMode( MapMode( MAP_TWIP ) );
    SetMapMode(MapMode(MAP_TWIP));
    aWinSize = GetOutputSizePixel();
    aWinSize.Height() -= 4;
    aWinSize.Width() -= 4;

    aWinSize = PixelToLogic( aWinSize );
    aWinSize = PixelToLogic(aWinSize);
    SetBackground();
}

@@ -111,67 +99,66 @@ SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) :

SvxPageWindow::~SvxPageWindow()
{
    delete pImpl;
    delete pHdBorder;
    delete pFtBorder;
}

// -----------------------------------------------------------------------

void __EXPORT SvxPageWindow::Paint( const Rectangle& )
void __EXPORT SvxPageWindow::Paint(const Rectangle&)
{
    Fraction aXScale( aWinSize.Width(), std::max( (long) (aSize.Width() * 2 + aSize.Width() / 8), 1L ) );
    Fraction aYScale( aWinSize.Height(), std::max( aSize.Height(), 1L ) );
    MapMode aMapMode( GetMapMode() );
    Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L));
    Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L));
    MapMode aMapMode(GetMapMode());

    if ( aYScale < aXScale )
    if(aYScale < aXScale)
    {
        aMapMode.SetScaleX( aYScale );
        aMapMode.SetScaleY( aYScale );
        aMapMode.SetScaleX(aYScale);
        aMapMode.SetScaleY(aYScale);
    }
    else
    {
        aMapMode.SetScaleX( aXScale );
        aMapMode.SetScaleY( aXScale );
        aMapMode.SetScaleX(aXScale);
        aMapMode.SetScaleY(aXScale);
    }
    SetMapMode( aMapMode );
    Size aSz( PixelToLogic( GetSizePixel() ) );
    long nYPos = ( aSz.Height() - aSize.Height() ) / 2;
    SetMapMode(aMapMode);
    Size aSz(PixelToLogic(GetSizePixel()));
    long nYPos = (aSz.Height() - aSize.Height()) / 2;

    if ( eUsage == SVX_PAGE_ALL )
    if(eUsage == SVX_PAGE_ALL)
    {
        // alle Seiten gleich -> eine Seite malen
        if ( aSize.Width() > aSize.Height() )
        if(aSize.Width() > aSize.Height())
        {
            // Querformat in gleicher Gr"osse zeichnen
            Fraction aX = aMapMode.GetScaleX();
            Fraction aY = aMapMode.GetScaleY();
            Fraction a2( 1.5 );
            Fraction a2(1.5);
            aX *= a2;
            aY *= a2;
            aMapMode.SetScaleX( aX );
            aMapMode.SetScaleY( aY );
            SetMapMode( aMapMode );
            aSz = PixelToLogic( GetSizePixel() );
            nYPos = ( aSz.Height() - aSize.Height() ) / 2;
            long nXPos = ( aSz.Width() - aSize.Width() ) / 2;
            DrawPage( Point( nXPos, nYPos ), sal_True, sal_True );
            aMapMode.SetScaleX(aX);
            aMapMode.SetScaleY(aY);
            SetMapMode(aMapMode);
            aSz = PixelToLogic(GetSizePixel());
            nYPos = (aSz.Height() - aSize.Height()) / 2;
            long nXPos = (aSz.Width() - aSize.Width()) / 2;
            DrawPage(Point(nXPos,nYPos),sal_True,sal_True);
        }
        else
            // Hochformat
            DrawPage( Point( ( aSz.Width() - aSize.Width() ) / 2, nYPos ), sal_True, sal_True );
            DrawPage(Point((aSz.Width() - aSize.Width()) / 2,nYPos),sal_True,sal_True);
    }
    else
    {
        // Linke und rechte Seite unterschiedlich -> ggf. zwei Seiten malen
        DrawPage( Point( 0, nYPos ), sal_False, (sal_Bool)( eUsage & SVX_PAGE_LEFT ) );
        DrawPage( Point( aSize.Width() + aSize.Width() / 8, nYPos ), sal_True,
                  (sal_Bool)( eUsage & SVX_PAGE_RIGHT ) );
        DrawPage(Point(0,nYPos),sal_False,(sal_Bool)(eUsage & SVX_PAGE_LEFT));
        DrawPage(Point(aSize.Width() + aSize.Width() / 8,nYPos),sal_True,
            (sal_Bool)(eUsage & SVX_PAGE_RIGHT));
    }
}

// -----------------------------------------------------------------------
void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const sal_Bool bEnabled )
void SvxPageWindow::DrawPage(const Point& rOrg,const sal_Bool bSecond,const sal_Bool bEnabled)
{
    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
    const Color& rFieldColor = rStyleSettings.GetFieldColor();
@@ -180,37 +167,37 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s
    const Color& rDlgColor = rStyleSettings.GetDialogColor();

    // background
    if(!bSecond || pImpl->bResetBackground)
    if(!bSecond || bResetBackground)
    {
        SetLineColor( Color(COL_TRANSPARENT) );
        SetFillColor( rDlgColor );
        SetLineColor(Color(COL_TRANSPARENT));
        SetFillColor(rDlgColor);
        Size winSize(GetOutputSize());
        DrawRect( Rectangle( Point(0,0), winSize ) );
        DrawRect(Rectangle(Point(0,0),winSize));

        if ( pImpl->bResetBackground )
            pImpl->bResetBackground = sal_False;
        if(bResetBackground)
            bResetBackground = sal_False;
    }
    SetLineColor( rFieldTextColor );
    SetLineColor(rFieldTextColor);
    // Schatten
    Size aTempSize = aSize;
    // Seite
    if ( !bEnabled )
    if(!bEnabled)
    {
        SetFillColor( rDisableColor );
        DrawRect( Rectangle( rOrg, aTempSize ) );
        SetFillColor(rDisableColor);
        DrawRect(Rectangle(rOrg,aTempSize));
        return;
    }
    SetFillColor( rFieldColor );
    DrawRect( Rectangle( rOrg, aTempSize ) );
    SetFillColor(rFieldColor);
    DrawRect(Rectangle(rOrg,aTempSize));

    // Border Top Bottom Left Right
    Point aBegin( rOrg );
    Point aEnd( rOrg );
    Point aBegin(rOrg);
    Point aEnd(rOrg);

    long nL = nLeft;
    long nR = nRight;

    if ( eUsage == SVX_PAGE_MIRROR && !bSecond )
    if(eUsage == SVX_PAGE_MIRROR && !bSecond)
    {
        // f"ur gespiegelt drehen
        nL = nRight;
@@ -219,91 +206,94 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s

    Rectangle aRect;

    aRect.Left()  = rOrg.X() + nL;
    aRect.Left() = rOrg.X() + nL;
    aRect.Right() = rOrg.X() + aTempSize.Width() - nR;
    aRect.Top()   = rOrg.Y() + nTop;
    aRect.Bottom()= rOrg.Y() + aTempSize.Height() - nBottom;
    aRect.Top() = rOrg.Y() + nTop;
    aRect.Bottom() = rOrg.Y() + aTempSize.Height() - nBottom;

    Rectangle aHdRect( aRect );
    Rectangle aFtRect( aRect );
    Rectangle aHdRect(aRect);
    Rectangle aFtRect(aRect);

    if ( bHeader )
    if(bHeader || bFooter)
    {
        // ggf. Header anzeigen
        aHdRect.Left() += nHdLeft;
        aHdRect.Right() -= nHdRight;
        aHdRect.Bottom() = aRect.Top() + nHdHeight;
        aRect.Top() += nHdHeight + nHdDist;
        SetFillColor( aHdColor );
        DrawRect( aHdRect );
    }
        //UUUU Header and/or footer used
        const Color aLineColor(GetLineColor());

    if ( bFooter )
    {
        // ggf. Footer anzeigen
        aFtRect.Left() += nFtLeft;
        aFtRect.Right() -= nFtRight;
        aFtRect.Top() = aRect.Bottom() - nFtHeight;
        aRect.Bottom() -= nFtHeight + nFtDist;
        SetFillColor( aFtColor );
        DrawRect( aFtRect );
    }
        //UUUU draw PageFill first and on the whole page, no outline
        SetLineColor();
        drawFillAttributes(maPageFillAttributes, aRect, aRect);
        SetLineColor(aLineColor);

    // Body malen
    SetFillColor( aColor );
    if ( pImpl->bBitmap )
    {
        DrawRect( aRect );
        Point aBmpPnt = aRect.TopLeft();
        Size aBmpSiz = aRect.GetSize();
        long nDeltaX = aBmpSiz.Width() / 15;
        long nDeltaY = aBmpSiz.Height() / 15;
        aBmpPnt.X() += nDeltaX;
        aBmpPnt.Y() += nDeltaY;
        aBmpSiz.Width() -= nDeltaX * 2;
        aBmpSiz.Height() -= nDeltaY * 2;
        DrawBitmap( aBmpPnt, aBmpSiz, pImpl->aBitmap );
        if(bHeader)
        {
            // ggf. Header anzeigen
            aHdRect.Left() += nHdLeft;
            aHdRect.Right() -= nHdRight;
            aHdRect.Bottom() = aRect.Top() + nHdHeight;
            aRect.Top() += nHdHeight + nHdDist;

            // draw header over PageFill, plus outline
            drawFillAttributes(maHeaderFillAttributes, aHdRect, aHdRect);
        }

        if(bFooter)
        {
            // ggf. Footer anzeigen
            aFtRect.Left() += nFtLeft;
            aFtRect.Right() -= nFtRight;
            aFtRect.Top() = aRect.Bottom() - nFtHeight;
            aRect.Bottom() -= nFtHeight + nFtDist;

            // draw footer over PageFill, plus outline
            drawFillAttributes(maFooterFillAttributes, aFtRect, aFtRect);
        }

        // draw page's reduced outline, only outline
        drawFillAttributes(drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect);
    }
    else
        DrawRect( aRect );

    if(pImpl->bFrameDirection && !bTable)
    {
       //pImpl->nFrameDirection
        //UUUU draw PageFill and outline
        drawFillAttributes(maPageFillAttributes, aRect, aRect);
    }

    if(bFrameDirection && !bTable)
    {
        //pImpl->nFrameDirection
        Point aPos;
        Font aFont(GetFont());
        const Size aSaveSize = aFont.GetSize();
        Size aDrawSize( 0, aRect.GetHeight() / 6);
        Size aDrawSize(0,aRect.GetHeight() / 6);
        aFont.SetSize(aDrawSize);
        SetFont(aFont);
        String sText(String::CreateFromAscii("ABC"));
        Point aMove(1, GetTextHeight());
        Point aMove(1,GetTextHeight());
        sal_Unicode cArrow = 0x2193;
        long nAWidth = GetTextWidth(String(sText.GetChar(0)));
        switch(pImpl->nFrameDirection)
        switch(nFrameDirection)
        {
            case FRMDIR_HORI_LEFT_TOP:
                aPos = aRect.TopLeft();
                aPos.X() += PixelToLogic(Point(1,1)).X();
                aMove.Y() = 0;
                cArrow = 0x2192;
        case FRMDIR_HORI_LEFT_TOP:
            aPos = aRect.TopLeft();
            aPos.X() += PixelToLogic(Point(1,1)).X();
            aMove.Y() = 0;
            cArrow = 0x2192;
            break;
            case FRMDIR_HORI_RIGHT_TOP:
                aPos = aRect.TopRight();
                aPos.X() -= nAWidth;
                aMove.Y() = 0;
                aMove.X() *= -1;
                cArrow = 0x2190;
        case FRMDIR_HORI_RIGHT_TOP:
            aPos = aRect.TopRight();
            aPos.X() -= nAWidth;
            aMove.Y() = 0;
            aMove.X() *= -1;
            cArrow = 0x2190;
            break;
            case FRMDIR_VERT_TOP_LEFT:
                aPos = aRect.TopLeft();
                aPos.X() += PixelToLogic(Point(1,1)).X();
                aMove.X() = 0;
        case FRMDIR_VERT_TOP_LEFT:
            aPos = aRect.TopLeft();
            aPos.X() += PixelToLogic(Point(1,1)).X();
            aMove.X() = 0;
            break;
            case FRMDIR_VERT_TOP_RIGHT:
                aPos = aRect.TopRight();
                aPos.X() -= nAWidth;
                aMove.X() = 0;
        case FRMDIR_VERT_TOP_RIGHT:
            aPos = aRect.TopRight();
            aPos.X() -= nAWidth;
            aMove.X() = 0;
            break;
        }
        sText.Append(cArrow);
@@ -315,13 +305,13 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s
            sal_Bool bHorizontal = 0 == aMove.Y();
            if(!bHorizontal)
            {
                nHDiff = (nAWidth - nCharWidth)/2;
                nHDiff = (nAWidth - nCharWidth) / 2;
                aPos.X() += nHDiff;
            }
            DrawText(aPos, sDraw);
            DrawText(aPos,sDraw);
            if(bHorizontal)
            {
                aPos.X() += aMove.X() < 0 ? - nCharWidth : nCharWidth;
                aPos.X() += aMove.X() < 0 ? -nCharWidth : nCharWidth;
            }
            else
            {
@@ -333,29 +323,99 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s
        SetFont(aFont);

    }
    if ( bTable )
    if(bTable)
    {
        // Tabelle malen, ggf. zentrieren
        SetLineColor( Color(COL_LIGHTGRAY) );
        SetLineColor(Color(COL_LIGHTGRAY));

        long nW = aRect.GetWidth(), nH = aRect.GetHeight();
        long nTW = CELL_WIDTH * 3, nTH = CELL_HEIGHT * 3;
        long nW = aRect.GetWidth(),nH = aRect.GetHeight();
        long nTW = CELL_WIDTH * 3,nTH = CELL_HEIGHT * 3;
        long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
        long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
        Rectangle aCellRect( Point( _nLeft, _nTop ), Size( CELL_WIDTH, CELL_HEIGHT ) );
        Rectangle aCellRect(Point(_nLeft,_nTop),Size(CELL_WIDTH,CELL_HEIGHT));

        for ( sal_uInt16 i = 0; i < 3; ++i )
        for(sal_uInt16 i = 0; i < 3; ++i)
        {
            aCellRect.Left() = _nLeft;
            aCellRect.Right() = _nLeft + CELL_WIDTH;
            if ( i > 0 )
                aCellRect.Move( 0, CELL_HEIGHT );
            if(i > 0)
                aCellRect.Move(0,CELL_HEIGHT);

            for ( sal_uInt16 j = 0; j < 3; ++j )
            for(sal_uInt16 j = 0; j < 3; ++j)
            {
                if ( j > 0 )
                    aCellRect.Move( CELL_WIDTH, 0 );
                DrawRect( aCellRect );
                if(j > 0)
                    aCellRect.Move(CELL_WIDTH,0);
                DrawRect(aCellRect);
            }
        }
    }
}

//UUUU
void SvxPageWindow::drawFillAttributes(
    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
    const Rectangle& rPaintRange,
    const Rectangle& rDefineRange)
{
    const basegfx::B2DRange aPaintRange(
        rPaintRange.Left(),
        rPaintRange.Top(),
        rPaintRange.Right(),
        rPaintRange.Bottom());

    if(!aPaintRange.isEmpty() &&
        !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
        !basegfx::fTools::equalZero(aPaintRange.getHeight()))
    {
        const basegfx::B2DRange aDefineRange(
            rDefineRange.Left(),
            rDefineRange.Top(),
            rDefineRange.Right(),
            rDefineRange.Bottom());

        // prepare primitive sequence
        drawinglayer::primitive2d::Primitive2DSequence aSequence;

        // create fill geometry if there is something to fill
        if(rFillAttributes.get() && rFillAttributes->isUsed())
        {
            aSequence = rFillAttributes->getPrimitive2DSequence(
                aPaintRange,
                aDefineRange);
        }

        // create line geometry if a LineColor is set at the target device
        if(IsLineColor())
        {
            const drawinglayer::primitive2d::Primitive2DReference xOutline(
                new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
                    basegfx::tools::createPolygonFromRect(aPaintRange),
                    GetLineColor().getBColor()));

            drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
                aSequence,
                xOutline);
        }

        // draw that if we have something to draw
        if(aSequence.getLength())
        {
            const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
                basegfx::B2DHomMatrix(),
                GetViewTransformation(),
                aPaintRange,
                0,
                0.0,
                com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >());
            drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
                *this,
                aViewInformation2D);

            if(pProcessor)
            {
                pProcessor->process(aSequence);

                delete pProcessor;
            }
        }
    }
@@ -363,55 +423,40 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s

// -----------------------------------------------------------------------

void SvxPageWindow::SetBorder( const SvxBoxItem& rNew )
void SvxPageWindow::SetBorder(const SvxBoxItem& rNew)
{
    delete pImpl->pBorder;
    pImpl->pBorder = new SvxBoxItem( rNew );
    delete pBorder;
    pBorder = new SvxBoxItem(rNew);
}

// -----------------------------------------------------------------------

void SvxPageWindow::SetBitmap( Bitmap* pBmp )
{
    if ( pBmp )
    {
        pImpl->aBitmap = *pBmp;
        pImpl->bBitmap = sal_True;
    }
    else
        pImpl->bBitmap = sal_False;
}

// -----------------------------------------------------------------------

void SvxPageWindow::SetHdBorder( const SvxBoxItem& rNew )
void SvxPageWindow::SetHdBorder(const SvxBoxItem& rNew)
{
    delete pHdBorder;
    pHdBorder = new SvxBoxItem( rNew );
    pHdBorder = new SvxBoxItem(rNew);
}
// -----------------------------------------------------------------------

void SvxPageWindow::SetFtBorder( const SvxBoxItem& rNew )
void SvxPageWindow::SetFtBorder(const SvxBoxItem& rNew)
{
    delete pFtBorder;
    pFtBorder = new SvxBoxItem( rNew );
    pFtBorder = new SvxBoxItem(rNew);
}
/* -----------------------------13.06.2002 16:16------------------------------

 ---------------------------------------------------------------------------*/
void  SvxPageWindow::EnableFrameDirection(sal_Bool bEnable)
void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable)
{
    pImpl->EnableFrameDirection(bEnable);
    bFrameDirection = bEnable;
}
/* -----------------------------13.06.2002 16:16------------------------------

 ---------------------------------------------------------------------------*/
void  SvxPageWindow::SetFrameDirection(sal_Int32 nFrameDirection)
void SvxPageWindow::SetFrameDirection(sal_Int32 nDirection)
{
    pImpl->SetFrameDirection(nFrameDirection);
    nFrameDirection = nDirection;
}

void SvxPageWindow::ResetBackground()
{
    pImpl->bResetBackground = sal_True;
    bResetBackground = sal_True;
}

//eof
diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
new file mode 100755
index 0000000..1814b3e
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
@@ -0,0 +1,275 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"

#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <drawinglayer/attribute/fillhatchattribute.hxx>
#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
#include <svx/xfillit0.hxx>
#include <vcl/graph.hxx>

//////////////////////////////////////////////////////////////////////////////

namespace drawinglayer
{
    namespace attribute
    {
        void SdrAllFillAttributesHelper::createPrimitive2DSequence(
            const basegfx::B2DRange& rPaintRange,
            const basegfx::B2DRange& rDefineRange)
        {
            // reset and remember new target range for object geometry
            maLastPaintRange = rPaintRange;
            maLastDefineRange = rDefineRange;

            if(isUsed())
            {
                maPrimitives.realloc(1);
                maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
                    basegfx::B2DPolyPolygon(
                        basegfx::tools::createPolygonFromRect(
                            maLastPaintRange)),
                        maLastDefineRange,
                    maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(),
                    maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute());
            }
        }

        SdrAllFillAttributesHelper::SdrAllFillAttributesHelper()
        :   maLastPaintRange(),
            maLastDefineRange(),
            maFillAttribute(),
            maFillGradientAttribute(),
            maPrimitives()
        {
        }

        SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const Color& rColor)
        :   maLastPaintRange(),
            maLastDefineRange(),
            maFillAttribute(),
            maFillGradientAttribute(),
            maPrimitives()
        {
            maFillAttribute.reset(
                new drawinglayer::attribute::SdrFillAttribute(
                    0.0,
                    Color(rColor.GetRGBColor()).getBColor(),
                    drawinglayer::attribute::FillGradientAttribute(),
                    drawinglayer::attribute::FillHatchAttribute(),
                    drawinglayer::attribute::SdrFillGraphicAttribute()));
        }

        SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const SfxItemSet& rSet)
        :   maLastPaintRange(),
            maLastDefineRange(),
            maFillAttribute(
                new drawinglayer::attribute::SdrFillAttribute(
                    drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))),
            maFillGradientAttribute(
                new drawinglayer::attribute::FillGradientAttribute(
                    drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))),
            maPrimitives()
        {
        }

        SdrAllFillAttributesHelper::~SdrAllFillAttributesHelper()
        {
        }

        bool SdrAllFillAttributesHelper::isUsed() const
        {
            // only depends on fill, FillGradientAttribute alone defines no fill
            return maFillAttribute.get() && !maFillAttribute->isDefault();
        }

        bool SdrAllFillAttributesHelper::isTransparent() const
        {
            if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
            {
                return true;
            }

            if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault())
            {
                return true;
            }

            if(hasSdrFillAttribute())
            {
                const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic();

                return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent();
            }

            return false;
        }

        const drawinglayer::attribute::SdrFillAttribute& SdrAllFillAttributesHelper::getFillAttribute() const
        {
            if(!maFillAttribute.get())
            {
                const_cast< SdrAllFillAttributesHelper* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute());
            }

            return *maFillAttribute.get();
        }

        const drawinglayer::attribute::FillGradientAttribute& SdrAllFillAttributesHelper::getFillGradientAttribute() const
        {
            if(!maFillGradientAttribute.get())
            {
                const_cast< SdrAllFillAttributesHelper* >(this)->maFillGradientAttribute.reset(new drawinglayer::attribute::FillGradientAttribute());
            }

            return *maFillGradientAttribute.get();
        }

        const drawinglayer::primitive2d::Primitive2DSequence& SdrAllFillAttributesHelper::getPrimitive2DSequence(
            const basegfx::B2DRange& rPaintRange,
            const basegfx::B2DRange& rDefineRange) const
        {
            if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange))
            {
                const_cast< SdrAllFillAttributesHelper* >(this)->maPrimitives.realloc(0);
            }

            if(!maPrimitives.getLength())
            {
                const_cast< SdrAllFillAttributesHelper* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
            }

            return maPrimitives;
        }

        basegfx::BColor SdrAllFillAttributesHelper::getAverageColor(const basegfx::BColor& rFallback) const
        {
            basegfx::BColor aRetval(rFallback);

            if(maFillAttribute.get() && !maFillAttribute->isDefault())
            {
                const drawinglayer::attribute::FillGradientAttribute& rFillGradientAttribute = maFillAttribute->getGradient();
                const drawinglayer::attribute::FillHatchAttribute& rFillHatchAttribute = maFillAttribute->getHatch();
                const drawinglayer::attribute::SdrFillGraphicAttribute& rSdrFillGraphicAttribute = maFillAttribute->getFillGraphic();
                const drawinglayer::attribute::FillGradientAttribute& rFillTransparenceGradientAttribute = getFillGradientAttribute();
                double fTransparence(maFillAttribute->getTransparence());

                if(!rFillTransparenceGradientAttribute.isDefault())
                {
                    const double fTransA = rFillTransparenceGradientAttribute.getStartColor().luminance();
                    const double fTransB = rFillTransparenceGradientAttribute.getEndColor().luminance();

                    fTransparence = (fTransA + fTransB) * 0.5;
                }

                if(!rFillGradientAttribute.isDefault())
                {
                    // gradient fill
                    const basegfx::BColor& rStart = rFillGradientAttribute.getStartColor();
                    const basegfx::BColor& rEnd = rFillGradientAttribute.getEndColor();

                    aRetval = basegfx::interpolate(rStart, rEnd, 0.5);
                }
                else if(!rFillHatchAttribute.isDefault())
                {
                    // hatch fill
                    const basegfx::BColor& rColor = rFillHatchAttribute.getColor();

                    if(rFillHatchAttribute.isFillBackground())
                    {
                        const basegfx::BColor& rBackgroundColor = maFillAttribute->getColor();

                        // mix colors 50%/50%
                        aRetval = basegfx::interpolate(rColor, rBackgroundColor, 0.5);
                    }
                    else
                    {
                        // mix color with fallback color
                        aRetval = basegfx::interpolate(rColor, rFallback, 0.5);
                    }
                }
                else if(!rSdrFillGraphicAttribute.isDefault())
                {
                    // graphic fill

                    // not used yet by purpose (see SwPageFrm::GetDrawBackgrdColor()),
                    // use fallback (already set)
                }
                else
                {
                    // color fill
                    aRetval = maFillAttribute->getColor();
                }

                if(!basegfx::fTools::equalZero(fTransparence))
                {
                    // blend into transparency
                    aRetval = basegfx::interpolate(aRetval, rFallback, fTransparence);
                }
            }

            return aRetval.clamp();
        }

        bool SdrAllFillAttributesHelper::needCompleteRepaint() const
        {
            if(!isUsed() || !hasSdrFillAttribute())
            {
                // not used or no fill
                return false;
            }

            const drawinglayer::attribute::SdrFillAttribute& rSdrFillAttribute = getFillAttribute();

            if(!rSdrFillAttribute.getHatch().isDefault())
            {
                // hatch is always top-left aligned, needs no full refreshes
                return false;
            }

            if(!rSdrFillAttribute.getGradient().isDefault())
            {
                // gradients always scale with the object
                return true;
            }

            if(!rSdrFillAttribute.getFillGraphic().isDefault())
            {
                // some graphic constellations may not need this, but since most do
                // (stretch to fill, all but top-left aligned, ...) claim to do by default
                return true;
            }

            // color fill
            return false;
        }
    } // end of namespace attribute
} // end of namespace drawinglayer

//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index a44b677..4f91243 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -135,7 +135,11 @@ namespace drawinglayer
                // create FillGradientPrimitive2D for transparence and add to new sequence
                // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways
                const basegfx::B2DRange aRange(basegfx::tools::getRange(rPolyPolygon));
                const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient));
                const Primitive2DReference xRefB(
                    new FillGradientPrimitive2D(
                        aRange,
                        rDefinitionRange,
                        rFillGradient));
                const Primitive2DSequence aAlpha(&xRefB, 1L);

                // create TransparencePrimitive2D using alpha and content
diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx
index 6dc193c..359b343 100644
--- a/svx/source/sidebar/tools/ColorControl.cxx
+++ b/svx/source/sidebar/tools/ColorControl.cxx
@@ -167,18 +167,20 @@ void ColorControl::GetFocus (void)



void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable)
void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable)
{
//  FillColors();
    short nCol = GetItemId_Imp( maVSColor, aCol );
    if(! bAvailable)
    //UUUU When transparent use transparent entry (entry 0)
    const bool bIsTransparent(0xff == aCol.GetTransparency());
    short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol);

    if(!bAvailable)
    {
        maVSColor.SetNoSelection();
        return;
    }

    //if not found
    if( nCol == -1)
    if(nCol == -1)
    {
        maVSColor.SetNoSelection();
    }
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index d909b43..21257d9 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -109,7 +109,19 @@ namespace svx
                else
                    pBmpAcc->SetLineColor( Color( COL_BLACK ) );

                pBmpAcc->SetFillColor( maCurColor = aColor );
                // use not only COL_TRANSPARENT for detection of transparence,
                // but the method/way which is designed to do that
                const bool bIsTransparent(0xff == aColor.GetTransparency());
                maCurColor = aColor;

                if(bIsTransparent)
                {
                    pBmpAcc->SetFillColor();
                }
                else
                {
                    pBmpAcc->SetFillColor(maCurColor);
                }

                if( TBX_UPDATER_MODE_CHAR_COLOR_NEW == mnDrawMode || TBX_UPDATER_MODE_NONE == mnDrawMode )
                {
@@ -146,7 +158,7 @@ namespace svx

                    if( pMskAcc )
                    {
                        if( COL_TRANSPARENT == aColor.GetColor() )
                        if( bIsTransparent )
                        {
                            pMskAcc->SetLineColor( COL_BLACK );
                            pMskAcc->SetFillColor( COL_WHITE );
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
new file mode 100644
index 0000000..733f3c9
--- /dev/null
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -0,0 +1,330 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"

#include <svx/unobrushitemhelper.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xgrscit.hxx>
#include <svx/xflbmtit.hxx>
#include <svx/xflbmpit.hxx>
#include <svx/xflbmsxy.hxx>
#include <svx/xflbmsxy.hxx>
#include <svx/xflftrit.hxx>
#include <svx/xsflclit.hxx>
#include <svx/xflbmsli.hxx>
#include <svx/xflbtoxy.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflboxy.hxx>
#include <svx/xflbckit.hxx>
#include <svx/xflclit.hxx>
#include <svx/xfltrit.hxx>
#include <svx/xflhtit.hxx>
#include <svx/unoshape.hxx>

//UUUU
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet)
{
    // Clear all items from the DrawingLayer FillStyle range (if we have any). All
    // items that need to be set will be set as hard attributes
    for(sal_uInt16 a(XATTR_FILL_FIRST); rToSet.Count() && a < XATTR_FILL_LAST; a++)
    {
        rToSet.ClearItem(a);
    }

    const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency());

    if(0xff != nTransparency)
    {
        // we have a color fill
        const Color aColor(rBrush.GetColor().GetRGBColor());

        rToSet.Put(XFillStyleItem(XFILL_SOLID));
        rToSet.Put(XFillColorItem(String(), aColor));

        // nTransparency is in range [0..255], convert to [0..100] which is used in XFillTransparenceItem
        rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255));
    }
    else if(GPOS_NONE != rBrush.GetGraphicPos())
    {
        // we have a graphic fill, set fill style
        rToSet.Put(XFillStyleItem(XFILL_BITMAP));

        // set graphic (if available)
        const Graphic* pGraphic = rBrush.GetGraphic();

        if(pGraphic)
        {
            rToSet.Put(XFillBitmapItem(String(), *pGraphic));
        }
        else
        {
            OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)");
        }

        if(GPOS_AREA == rBrush.GetGraphicPos())
        {
            // stretch, also means no tile (both items are defaulted to true)
            rToSet.Put(XFillBmpStretchItem(true));
            rToSet.Put(XFillBmpTileItem(false));

            // default for strech is also top-left, but this will not be visible
            rToSet.Put(XFillBmpPosItem(RP_LT));
        }
        else if(GPOS_TILED == rBrush.GetGraphicPos())
        {
            // tiled, also means no stretch (both items are defaulted to true)
            rToSet.Put(XFillBmpStretchItem(false));
            rToSet.Put(XFillBmpTileItem(true));

            // default for tiled is top-left
            rToSet.Put(XFillBmpPosItem(RP_LT));
        }
        else
        {
            // everything else means no tile and no stretch
            rToSet.Put(XFillBmpStretchItem(false));
            rToSet.Put(XFillBmpTileItem(false));

            RECT_POINT aRectPoint(RP_MM);

            switch(rBrush.GetGraphicPos())
            {
                case GPOS_LT: aRectPoint = RP_LT; break;
                case GPOS_MT: aRectPoint = RP_MT; break;
                case GPOS_RT: aRectPoint = RP_RT; break;
                case GPOS_LM: aRectPoint = RP_LM; break;
                case GPOS_MM: aRectPoint = RP_MM; break;
                case GPOS_RM: aRectPoint = RP_RM; break;
                case GPOS_LB: aRectPoint = RP_LB; break;
                case GPOS_MB: aRectPoint = RP_MB; break;
                case GPOS_RB: aRectPoint = RP_RB; break;
                default: break; // GPOS_NONE, GPOS_AREA and GPOS_TILED already handled
            }

            rToSet.Put(XFillBmpPosItem(aRectPoint));
        }

        // check for graphic's transparency
        const sal_Int8 nGraphicTransparency(rBrush.getGraphicTransparency());

        if(0 != nGraphicTransparency)
        {
            // nGraphicTransparency is in range [0..100]
            rToSet.Put(XFillTransparenceItem(nGraphicTransparency));
        }
    }
    else
    {
        // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(),
        // still need to rescue the color used. There are sequences used on the UNO API at
        // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B,
        // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY)
        // to zero later. When not saving the color, it will be lost.
        // Also need to set the FillStyle to NONE to express the 0xff transparency flag; this
        // is needed when e.g. first transparency is set to 0xff and then a Graphic gets set.
        // When not changing the FillStyle, the next getSvxBrushItemFromSourceSet *will* return
        // to XFILL_SOLID with the rescued color.
        const Color aColor(rBrush.GetColor().GetRGBColor());

        rToSet.Put(XFillStyleItem(XFILL_NONE));
        rToSet.Put(XFillColorItem(String(), aColor));
    }
}

//UUUU
sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents)
{
    sal_uInt16 nFillTransparence(static_cast< const XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, bSearchInParents)).GetValue());
    const SfxPoolItem* pGradientItem = 0;

    if(SFX_ITEM_SET == rSourceSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents, &pGradientItem)
        && static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->IsEnabled())
    {
        const XGradient& rGradient = static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->GetGradientValue();
        const sal_uInt16 nStartLuminance(rGradient.GetStartColor().GetLuminance());
        const sal_uInt16 nEndLuminance(rGradient.GetEndColor().GetLuminance());

        // luminance is [0..255], transparence needs to be in [0..100].Maximum is 51200, thus sal_uInt16 is okay to use
        nFillTransparence = static_cast< sal_uInt16 >(((nStartLuminance + nEndLuminance) * 100) / 512);
    }

    return nFillTransparence;
}

//UUUU
SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents, sal_uInt16 nBackgroundID)
{
    Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());

    // get evtl. mixed transparence
    const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

    if(0 != nFillTransparence)
    {
        // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
        aFillColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
    }

    return SvxBrushItem(aFillColor, nBackgroundID);
}

//UUUU
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, sal_Bool bSearchInParents)
{
    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));

    if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue())
    {
        // no fill, still need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE)
        Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
        aFillColor.SetTransparency(0xff);

        return SvxBrushItem(aFillColor, nBackgroundID);
    }

    SvxBrushItem aRetval(nBackgroundID);

    switch(pXFillStyleItem->GetValue())
    {
        case XFILL_NONE:
        {
            // already handled above, can not happen again
            break;
        }
        case XFILL_SOLID:
        {
            // create SvxBrushItem with fill color
            aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID);
            break;
        }
        case XFILL_GRADIENT:
        {
            // cannot be directly supported, but do the best possible
            const XGradient aXGradient(static_cast< const XFillGradientItem& >(rSourceSet.Get(XATTR_FILLGRADIENT)).GetGradientValue());
            const basegfx::BColor aStartColor(aXGradient.GetStartColor().getBColor() * (aXGradient.GetStartIntens() * 0.01));
            const basegfx::BColor aEndColor(aXGradient.GetEndColor().getBColor() * (aXGradient.GetEndIntens() * 0.01));

            // use half/half mixed color from gradient start and end
            Color aMixedColor((aStartColor + aEndColor) * 0.5);

            // get evtl. mixed transparence
            const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

            if(0 != nFillTransparence)
            {
                // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
                aMixedColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
            }

            aRetval = SvxBrushItem(aMixedColor, nBackgroundID);
            break;
        }
        case XFILL_HATCH:
        {
            // cannot be directly supported, but do the best possible
            const XHatch& rHatch(static_cast< const XFillHatchItem& >(rSourceSet.Get(XATTR_FILLHATCH)).GetHatchValue());
            const bool bFillBackground(static_cast< const XFillBackgroundItem& >(rSourceSet.Get(XATTR_FILLBACKGROUND)).GetValue());

            if(bFillBackground)
            {
                // hatch is background-filled, use FillColor as if XFILL_SOLID
                aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID);
            }
            else
            {
                // hatch is not background-filled and using hatch color would be too dark; compensate
                // somewhat by making it more transparent
                Color aHatchColor(rHatch.GetColor());

                // get evtl. mixed transparence
                sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

                // take half orig transparence, add half transparent, clamp result
                nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255);

                // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
                aHatchColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));

                aRetval = SvxBrushItem(aHatchColor, nBackgroundID);
            }

            break;
        }
        case XFILL_BITMAP:
        {
            // create SvxBrushItem with bitmap info and flags
            const XFillBitmapItem& rBmpItm = static_cast< const XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP, bSearchInParents));
            const Graphic aGraphic(rBmpItm.GetGraphicObject().GetGraphic());

            // continue idependent of evtl. GRAPHIC_NONE as aGraphic.GetType(), we still need to rescue positions
            SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE);
            const XFillBmpStretchItem& rStretchItem = static_cast< const XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents));
            const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents));

            if(rTileItem.GetValue())
            {
                aSvxGraphicPosition = GPOS_TILED;
            }
            else if(rStretchItem.GetValue())
            {
                aSvxGraphicPosition = GPOS_AREA;
            }
            else
            {
                const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents));

                switch(rPosItem.GetValue())
                {
                    case RP_LT: aSvxGraphicPosition = GPOS_LT; break;
                    case RP_MT: aSvxGraphicPosition = GPOS_MT; break;
                    case RP_RT: aSvxGraphicPosition = GPOS_RT; break;
                    case RP_LM: aSvxGraphicPosition = GPOS_LM; break;
                    case RP_MM: aSvxGraphicPosition = GPOS_MM; break;
                    case RP_RM: aSvxGraphicPosition = GPOS_RM; break;
                    case RP_LB: aSvxGraphicPosition = GPOS_LB; break;
                    case RP_MB: aSvxGraphicPosition = GPOS_MB; break;
                    case RP_RB: aSvxGraphicPosition = GPOS_RB; break;
                }
            }

            // create with given graphic and position
            aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID);

            // get evtl. mixed transparence
            const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

            if(0 != nFillTransparence)
            {
                // nFillTransparence is in range [0..100] and needs to be in [0..100] signed
                aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence));
            }

            break;
        }
    }

    return aRetval;
}

//eof
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 06394eb..ebda1cb 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -281,7 +281,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
    sw/source/core/layout/anchoreddrawobject \
    sw/source/core/layout/anchoredobject \
    sw/source/core/layout/atrfrm \
    sw/source/core/layout/fillattributes \
    sw/source/core/layout/calcmove \
    sw/source/core/layout/colfrm \
    sw/source/core/layout/dbg_lay \
@@ -450,7 +449,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
    sw/source/core/unocore/unoport \
    sw/source/core/unocore/unoportenum \
    sw/source/core/unocore/unoprnms \
    sw/source/core/unocore/unobrushitemhelper \
    sw/source/core/unocore/unoredline \
    sw/source/core/unocore/unoredlines \
    sw/source/core/unocore/unorefmk \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 593d353..e9ffd3f 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -815,24 +815,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_UNO_FOOTER                       (FN_EXTRA2 + 38)
#define FN_UNO_FOOTER_LEFT                  (FN_EXTRA2 + 39)
#define FN_UNO_FOOTER_RIGHT                 (FN_EXTRA2 + 40)
#define FN_UNO_HEADER_BACKGROUND            (FN_EXTRA2 + 41)
#define FN_UNO_HEADER_BOX                   (FN_EXTRA2 + 42)
#define FN_UNO_HEADER_LR_SPACE              (FN_EXTRA2 + 43)
#define FN_UNO_HEADER_SHADOW                (FN_EXTRA2 + 44)
#define FN_UNO_FOOTER_BACKGROUND            (FN_EXTRA2 + 45)
#define FN_UNO_FOOTER_BOX                   (FN_EXTRA2 + 46)
#define FN_UNO_FOOTER_LR_SPACE              (FN_EXTRA2 + 47)
#define FN_UNO_FOOTER_SHADOW                (FN_EXTRA2 + 48)
#define FN_UNO_HEADER_BODY_DISTANCE         (FN_EXTRA2 + 49)
#define FN_UNO_HEADER_IS_DYNAMIC_DISTANCE   (FN_EXTRA2 + 50)
#define FN_UNO_FOOTER_BODY_DISTANCE         (FN_EXTRA2 + 51)
#define FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE   (FN_EXTRA2 + 52)
#define FN_UNO_HEADER_SHARE_CONTENT         (FN_EXTRA2 + 53)
#define FN_UNO_FOOTER_SHARE_CONTENT         (FN_EXTRA2 + 54)
#define FN_UNO_HEADER_HEIGHT                (FN_EXTRA2 + 55)
#define FN_UNO_FOOTER_HEIGHT                (FN_EXTRA2 + 56)
#define FN_UNO_HEADER_ON                    (FN_EXTRA2 + 57)
#define FN_UNO_FOOTER_ON                    (FN_EXTRA2 + 58)
#define FN_UNO_FOLLOW_STYLE                 (FN_EXTRA2 + 59)

#define FN_API_CALL                         (FN_EXTRA2 + 60)
@@ -871,8 +853,6 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
#define FN_NEW_GLOSSARY                     (FN_EXTRA2 + 90)
#define FN_SET_ACT_GLOSSARY                 (FN_EXTRA2 + 91)

#define FN_UNO_HEADER_EAT_SPACING           (FN_EXTRA2 + 92)
#define FN_UNO_FOOTER_EAT_SPACING           (FN_EXTRA2 + 93)
#define FN_UNO_CHARFMT_SEQUENCE             (FN_EXTRA2 + 94)
#define FN_UNO_CLSID                        (FN_EXTRA2 + 95)
#define FN_UNO_MODEL                        (FN_EXTRA2 + 96)
diff --git a/sw/inc/fillattributes.hxx b/sw/inc/fillattributes.hxx
deleted file mode 100755
index c9626ab..0000000
--- a/sw/inc/fillattributes.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef FILLATTRIBUTES_HXX
#define FILLATTRIBUTES_HXX

#include <drawinglayer/attribute/fillgradientattribute.hxx>
#include <drawinglayer/attribute/sdrfillattribute.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <boost/shared_ptr.hpp>
#include <tools/color.hxx>
#include <svl/itemset.hxx>

//////////////////////////////////////////////////////////////////////////////

class FillAttributes
{
private:
    basegfx::B2DRange                                                   maLastPaintRange;
    basegfx::B2DRange                                                   maLastDefineRange;
    boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute >      maFillAttribute;
    boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > maFillGradientAttribute;
    drawinglayer::primitive2d::Primitive2DSequence                      maPrimitives;

    void createPrimitive2DSequence(
        const basegfx::B2DRange& rPaintRange,
        const basegfx::B2DRange& rDefineRange);

protected:
public:
    FillAttributes();
    FillAttributes(const Color& rColor);
    FillAttributes(const SfxItemSet& rSet);
    ~FillAttributes();

    bool isUsed() const;
    bool hasSdrFillAttribute() const { return maFillAttribute.get(); }
    bool hasFillGradientAttribute() const { return maFillGradientAttribute.get(); }
    bool isTransparent() const;

    const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
    const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const;
    const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence(
        const basegfx::B2DRange& rPaintRange,
        const basegfx::B2DRange& rDefineRange) const;
};

//////////////////////////////////////////////////////////////////////////////

typedef boost::shared_ptr< FillAttributes > FillAttributesPtr;

//////////////////////////////////////////////////////////////////////////////

#endif // FILLATTRIBUTES_HXX

// eof
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index c5542f1..360358c 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -19,7 +19,6 @@
 *
 *************************************************************/


#ifndef _FORMAT_HXX
#define _FORMAT_HXX

@@ -29,8 +28,7 @@
#include <swatrset.hxx>     // fuer SfxItemPool/-Set, Attr forward decl.
#include <calbck.hxx>       // fuer SwModify
#include <hintids.hxx>
//UUUU
#include <fillattributes.hxx>
#include <boost/shared_ptr.hpp>

class IDocumentSettingAccess;
class IDocumentDrawModelAccess;
@@ -40,6 +38,11 @@ class IDocumentFieldsAccess;
class IDocumentChartDataProviderAccess;
class SwDoc;

namespace drawinglayer { namespace attribute {
    class SdrAllFillAttributesHelper;
    typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
}}

class SW_DLLPUBLIC SwFmt : public SwModify
{
    String aFmtName;
@@ -243,7 +246,7 @@ public:
    inline const SvxBoxItem               &GetBox( sal_Bool = sal_True ) const;
    inline const SvxFmtKeepItem         &GetKeep( sal_Bool = sal_True ) const;

    //UUUU
    //UUUU Get SvxBrushItem for Background fill (partially for backwards compatibility)
    const SvxBrushItem& GetBackground( sal_Bool = sal_True ) const;

    inline const SvxShadowItem            &GetShadow( sal_Bool = sal_True ) const;
@@ -330,18 +333,12 @@ public:
    */
    virtual sal_Bool IsShadowTransparent() const;

    //UUUU
    virtual FillAttributesPtr getFillAttributes() const;
    //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
    virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
};

// --------------- inline Implementierungen ------------------------

//UUUUinline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich,
//UUUU                                             sal_Bool bInParents ) const
//UUUU{
//UUUU  return aSet.Get( nWhich, bInParents );
//UUUU}

inline void SwFmt::SetName( const sal_Char* pNewName,
                             sal_Bool bBroadcast )
{
@@ -349,12 +346,6 @@ inline void SwFmt::SetName( const sal_Char* pNewName,
    SetName( aTmp, bBroadcast );
}

//UUUUinline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent,
//UUUU                                      const SfxPoolItem **ppItem ) const
//UUUU{
//UUUU  return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
//UUUU}

#undef inline

#endif // _FORMAT_HXX
diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx
index f9facc7..8ad974b 100644
--- a/sw/inc/frmatr.hxx
+++ b/sw/inc/frmatr.hxx
@@ -81,8 +81,6 @@ inline const SvxBoxItem &SwFmt::GetBox(sal_Bool bInP) const
    { return aSet.GetBox(bInP); }
inline const SvxFmtKeepItem &SwFmt::GetKeep(sal_Bool bInP) const
    { return aSet.GetKeep(bInP); }
//UUUUinline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const
//UUUU  { return aSet.GetBackground(bInP); }
inline const SvxShadowItem &SwFmt::GetShadow(sal_Bool bInP) const
    { return aSet.GetShadow(bInP); }
inline const SvxFmtBreakItem &SwFmt::GetBreak(sal_Bool bInP) const
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index b12c95e..f5ce6ad 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -47,8 +47,8 @@ class SW_DLLPUBLIC SwFrmFmt: public SwFmt
    ::com::sun::star::uno::WeakReference<
        ::com::sun::star::uno::XInterface> m_wXObject;

    //UUUU
    FillAttributesPtr           maFillAttributes;
    //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maFillAttributes;

protected:
    SwFrmFmt* pCaptionFmt;
@@ -147,8 +147,8 @@ public:
    DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
    void RegisterToFormat( SwFmt& rFmt );

    //UUUU
    virtual FillAttributesPtr getFillAttributes() const;
    //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
    virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
};

//Das FlyFrame-Format ------------------------------
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index dcecdc0d..abefc16 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -19,12 +19,12 @@
 *
 *************************************************************/


#ifndef _HINTIDS_HXX
#define _HINTIDS_HXX

#include <tools/solar.h>        // fuer __FAR_DATA
#include <sal/types.h>          // for sal_Unicode
#include <svx/xdef.hxx>
#include "swdllapi.h"

// fuer SwTxtHints ohne Endindex wird folgendes Zeichen eingefuegt:
@@ -405,11 +405,16 @@ inline bool isPARATR(const sal_uInt16 nWhich)
}
inline bool isPARATR_LIST(const sal_uInt16 nWhich)
{
    return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); }
    return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich);
}
inline bool isFRMATR(const sal_uInt16 nWhich)
{
    return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich);
}
inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich) //UUUU
{
    return (XATTR_FILL_FIRST <= nWhich) && (XATTR_FILL_LAST >= nWhich);
}
inline bool isGRFATR(const sal_uInt16 nWhich)
{
    return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 918b97a..4d56b86 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -107,13 +107,33 @@ public:
    SwDelTxt( xub_StrLen nS, xub_StrLen nL );
};

class SwUpdateAttr: public SwMsgPoolItem
class SwUpdateAttr : public SwMsgPoolItem
{
public:
private:
    xub_StrLen nStart;
    xub_StrLen nEnd;
    sal_uInt16 nWhichAttr;
    SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW );

public:
    SwUpdateAttr(
        xub_StrLen nS,
        xub_StrLen nE,
        sal_uInt16 nW);

    xub_StrLen getStart() const
    {
        return nStart;
    }

    xub_StrLen getEnd() const
    {
        return nEnd;
    }

    sal_uInt16 getWhichAttr() const
    {
        return nWhichAttr;
    }
};


diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 7cfcc56..4559498 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -125,6 +125,9 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
    ::com::sun::star::uno::WeakReference<
        ::com::sun::star::text::XTextContent> m_wXParagraph;

    //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maFillAttributes;

    SW_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl,
                             const SfxItemSet* pAutoAttr = 0 );

@@ -828,6 +831,9 @@ public:
        ::com::sun::star::rdf::XMetadatable > MakeUnoObject();

    DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)

    //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
    virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
};

//-----------------------------------------------------------------------------
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 1e54285..83472fe 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -81,6 +81,12 @@ class IDocumentContentOperations;
class IDocumentListItems;
class SwOLENodes;

//UUUU
namespace drawinglayer { namespace attribute {
    class SdrAllFillAttributesHelper;
    typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
}}

// --------------------
// class SwNode
// --------------------
@@ -508,6 +514,9 @@ public:

    static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize );

    //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
    virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;

private:
    // privater Constructor, weil nie kopiert werden darf !!
    SwCntntNode( const SwCntntNode & rNode );
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 6147325..d09db89 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -141,8 +141,10 @@ class SwTblBoxValue;
class SwAttrPool : public SfxItemPool
{
private:
    ///UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor
    /// and destructor; still isolated to evtl. allow other use later
    //UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor
    // and destructor; still isolated to evtl. allow other use later, but
    // used bz default now to have it instantly as needed for DrawingLayer
    // FillStyle support
    void createAndAddSecondaryPools();
    void removeAndDeleteSecondaryPools();

diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx
index 7c760a0f..c13140c 100644
--- a/sw/inc/swunohelper.hxx
+++ b/sw/inc/swunohelper.hxx
@@ -37,6 +37,9 @@ class String;
class SvStrings;
class SvPtrarr;

//UUUU
class SfxItemSet;

namespace SWUnoHelper {

// calls over the compherl the getEnumAsInt32 function and handle the
@@ -72,6 +75,12 @@ SW_DLLPUBLIC sal_Bool UCB_IsFile( const String& rURL );

    // is the URL a existing directory?
sal_Bool UCB_IsDirectory( const String& rURL );

///UUUU helper to check if fill style is set to color or bitmap
/// and thus formally used SvxBrushItem parts need to be mapped
/// for backwards compatibility
bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet);

}

#endif
diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx
deleted file mode 100644
index 03edfff..0000000
--- a/sw/inc/unobrushitemhelper.hxx
+++ /dev/null
@@ -1,33 +0,0 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef _UNOBRUSHITEMHELPER_HXX
#define _UNOBRUSHITEMHELPER_HXX

#include <editeng/brshitem.hxx>

//UUUU helper function definintions for UNO API fallbacks to replace SvxBrushItem
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet);
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents = sal_True);

#endif // _UNOBRUSHITEMHELPER_HXX

//eof
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 461b386..b9894c1 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -76,11 +76,6 @@ class SwXFrame : public cppu::WeakImplHelper6

    SwPaM*                          m_pCopySource;

    ///UUUU helper to check if fill style is set to color or bitmap
    /// and thus formally used SvxBrushItem parts need to be mapped
    /// for backwards compatibility
    bool needToMapFillItemsToSvxBrushItemTypes() const;

protected:
    com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData;
    com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >  mxStyleFamily;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index ec38cf2..483a55c7e 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -814,7 +814,61 @@ enum SwPropNameIds
/* 0768 */ UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME,
/* 0769 */ UNO_NAME_SW_FILLCOLOR_2,

/* 0770 */  SW_PROPNAME_END
/* 0770 */ UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE,
/* 0771 */ UNO_NAME_HEADER_FILLBMP_OFFSET_X,
/* 0772 */ UNO_NAME_HEADER_FILLBMP_OFFSET_Y,
/* 0773 */ UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X,
/* 0774 */ UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y,
/* 0775 */ UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT,
/* 0776 */ UNO_NAME_HEADER_FILLBMP_SIZE_X,
/* 0777 */ UNO_NAME_HEADER_FILLBMP_SIZE_Y,
/* 0778 */ UNO_NAME_HEADER_FILLBMP_STRETCH,
/* 0779 */ UNO_NAME_HEADER_FILLBMP_TILE,
/* 0780 */ UNO_NAME_HEADER_FILLBMP_MODE,
/* 0781 */ UNO_NAME_HEADER_FILLCOLOR,
/* 0782 */ UNO_NAME_HEADER_FILLBACKGROUND,
/* 0783 */ UNO_NAME_HEADER_FILLBITMAP,
/* 0784 */ UNO_NAME_HEADER_FILLBITMAPNAME,
/* 0785 */ UNO_NAME_HEADER_FILLBITMAPURL,
/* 0786 */ UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT,
/* 0787 */ UNO_NAME_HEADER_FILLGRADIENT,
/* 0788 */ UNO_NAME_HEADER_FILLGRADIENTNAME,
/* 0789 */ UNO_NAME_HEADER_FILLHATCH,
/* 0790 */ UNO_NAME_HEADER_FILLHATCHNAME,
/* 0791 */ UNO_NAME_HEADER_FILLSTYLE,
/* 0792 */ UNO_NAME_HEADER_FILL_TRANSPARENCE,
/* 0793 */ UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT,
/* 0794 */ UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME,
/* 0795 */ UNO_NAME_HEADER_FILLCOLOR_2,

/* 0776 */ UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE,
/* 0777 */ UNO_NAME_FOOTER_FILLBMP_OFFSET_X,
/* 0778 */ UNO_NAME_FOOTER_FILLBMP_OFFSET_Y,
/* 0779 */ UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X,
/* 0780 */ UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y,
/* 0781 */ UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT,
/* 0782 */ UNO_NAME_FOOTER_FILLBMP_SIZE_X,
/* 0783 */ UNO_NAME_FOOTER_FILLBMP_SIZE_Y,
/* 0784 */ UNO_NAME_FOOTER_FILLBMP_STRETCH,
/* 0785 */ UNO_NAME_FOOTER_FILLBMP_TILE,
/* 0786 */ UNO_NAME_FOOTER_FILLBMP_MODE,
/* 0787 */ UNO_NAME_FOOTER_FILLCOLOR,
/* 0788 */ UNO_NAME_FOOTER_FILLBACKGROUND,
/* 0789 */ UNO_NAME_FOOTER_FILLBITMAP,
/* 0790 */ UNO_NAME_FOOTER_FILLBITMAPNAME,
/* 0791 */ UNO_NAME_FOOTER_FILLBITMAPURL,
/* 0792 */ UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT,
/* 0793 */ UNO_NAME_FOOTER_FILLGRADIENT,
/* 0794 */ UNO_NAME_FOOTER_FILLGRADIENTNAME,
/* 0795 */ UNO_NAME_FOOTER_FILLHATCH,
/* 0796 */ UNO_NAME_FOOTER_FILLHATCHNAME,
/* 0797 */ UNO_NAME_FOOTER_FILLSTYLE,
/* 0798 */ UNO_NAME_FOOTER_FILL_TRANSPARENCE,
/* 0799 */ UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT,
/* 0800 */ UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME,
/* 0801 */ UNO_NAME_FOOTER_FILLCOLOR_2,

/* 0802 */  SW_PROPNAME_END
};


diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index 0739a34..c0d9912 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -391,6 +391,7 @@ public:
    virtual sal_Bool SAL_CALL SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);

};

class SwXAutoStylesEnumerator : public cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >,
    public SwClient
{
@@ -418,8 +419,10 @@ class SwXAutoStyle : public cppu::WeakImplHelper3
>,
    public SwClient
{
    SfxItemSet_Pointer_t    pSet;
    IStyleAccess::SwAutoStyleFamily       eFamily;
private:
    SfxItemSet_Pointer_t                mpSet;
    IStyleAccess::SwAutoStyleFamily     meFamily;
    SwDoc&                              mrDoc;

    ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);

diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 74737be..8a20897 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1209,7 +1209,7 @@ bool lcl_GetBackgroundColor( Color & rColor,
    SwRect aDummyRect;

    //UUUU
    FillAttributesPtr aFillAttributes;
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

    if ( pFrm &&
         pFrm->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false ) )
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index 45b954f..5835494 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -197,8 +197,10 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
                {
                    // und dann in der externen Darstellung
                    aCopy.PtrToBoxNm( &pTblNd->GetTable() );
                    pUpdtFld->pHistory->Add( &aCopy, &aCopy,
                                pNd->FindTableBoxStartNode()->GetIndex() );
                    pUpdtFld->pHistory->Add(
                        &aCopy,
                        &aCopy,
                        pNd->FindTableBoxStartNode()->GetIndex());
                }
            }
            else
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 9cace99..92f81e41 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -30,8 +30,10 @@
#include <paratr.hxx>           // fuer SwParaFmt - SwHyphenBug
#include <swcache.hxx>
#include <fmtcolfunc.hxx>

//UUUU
#include <unobrushitemhelper.hxx>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <svx/xdef.hxx>
#include <frmatr.hxx>

@@ -434,7 +436,7 @@ sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)

const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const
{
    if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which())
    if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
    {
        //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
@@ -443,7 +445,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) c
        // fill the local static SvxBrushItem from the current ItemSet so that
        // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
        // as good as possible to create a fallback representation and return that
        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInParents);
        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInParents);

        return aSvxBrushItem;
    }
@@ -454,11 +456,11 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) c

SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent, const SfxPoolItem **ppItem ) const
{
    if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which())
    if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
    {
        //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
        const FillAttributesPtr aFill = getFillAttributes();
        const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();

        // check if the new fill attributes are used
        if(aFill.get() && aFill->isUsed())
@@ -468,7 +470,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent, con
            // to and return as state that it is set
            static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);

            aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bSrchInParent);
            aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent);
            *ppItem = &aSvxBrushItem;

            return SFX_ITEM_SET;
@@ -496,7 +498,7 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
    sal_Bool bRet = sal_False;

    //UUUU
    if(RES_BACKGROUND == rAttr.Which() && RES_FLYFRMFMT == Which())
    if(RES_BACKGROUND == rAttr.Which() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
    {
        //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
@@ -586,7 +588,7 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )

    sal_Bool bRet = sal_False;

    //UUUU Usel local copy to be able to apply needed changes, e.g. call
    //UUUU Use local copy to be able to apply needed changes, e.g. call
    // CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff
    SfxItemSet aTempSet(rSet);

@@ -598,8 +600,8 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
        GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet);
    }

    //UUUU
    if(RES_FLYFRMFMT == Which())
    //UUUU   FlyFrame              PageStyle
    if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
    {
        const SfxPoolItem* pSource = 0;

@@ -841,7 +843,8 @@ IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() {
//UUUU
const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
{
    if(RES_FLYFRMFMT == Which())
    //UUUU   FlyFrame              PageStyle
    if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
    {
        //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
@@ -850,7 +853,7 @@ const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
        // fill the local static SvxBrushItem from the current ItemSet so that
        // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
        // as good as possible to create a fallback representation and return that
        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInP);
        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP);

        return aSvxBrushItem;
    }
@@ -859,12 +862,9 @@ const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
}

//UUUU
FillAttributesPtr SwFmt::getFillAttributes() const
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFmt::getSdrAllFillAttributesHelper() const
{
    // FALLBACKBREAKHERE return empty pointer
    OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)");

    return FillAttributesPtr();
    return drawinglayer::attribute::SdrAllFillAttributesHelperPtr();
}

// eof
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 6967e8e..2d460e2 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -64,12 +64,16 @@ SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )



SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW )
    : SwMsgPoolItem( RES_UPDATE_ATTR ),
    nStart( nS ),
    nEnd( nE ),
    nWhichAttr( nW )
{}
SwUpdateAttr::SwUpdateAttr(
    xub_StrLen nS,
    xub_StrLen nE,
    sal_uInt16 nW)
:   SwMsgPoolItem(RES_UPDATE_ATTR),
    nStart(nS),
    nEnd(nE),
    nWhichAttr(nW)
{
}


// SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 44b623d..c6d7c710 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -182,6 +182,10 @@ sal_uInt16 __FAR_DATA aTxtNodeSetRange[] = {
    RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
    // <--
    RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,

    //UUUU FillAttribute support (paragraph FillStyle)
    XATTR_FILL_FIRST, XATTR_FILL_LAST,

    0
};

@@ -236,7 +240,7 @@ sal_uInt16 __FAR_DATA aFrmFmtSetRange[] = {
    RES_FRMATR_BEGIN, RES_FRMATR_END-1,
    RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,

    //UUUU FillAttribute support
    //UUUU FillAttribute support (TextFrame, OLE, Writer GraphicObject)
    XATTR_FILL_FIRST, XATTR_FILL_LAST,

    0
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index cceb389..5dca2c5 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -153,37 +153,72 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
// funktioniert nicht richtig, wenn man unterschiedliche WhichRanges hat.
/////////////// !!!!!!!!!!!!!!!!
    //Die interressanten Attribute uebernehmen.
    sal_uInt16 __READONLY_DATA aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE,
                                        RES_BACKGROUND, RES_SHADOW,
                                        RES_COL, RES_COL,
                                        RES_FRAMEDIR, RES_FRAMEDIR,
                                        RES_TEXTGRID, RES_TEXTGRID,
                                        // --> FME 2005-04-18 #i45539#
                                        RES_HEADER_FOOTER_EAT_SPACING,
                                        RES_HEADER_FOOTER_EAT_SPACING,
                                        // <--
                                        RES_UNKNOWNATR_CONTAINER,
                                        RES_UNKNOWNATR_CONTAINER,
                                        0 };
    sal_uInt16 __READONLY_DATA aIdArr[] = {
        RES_FRM_SIZE,                   RES_UL_SPACE,                   // [83..86
        RES_BACKGROUND,                 RES_SHADOW,                     // [99..101
        RES_COL,                        RES_COL,                        // [103
        RES_TEXTGRID,                   RES_TEXTGRID,                   // [109
        RES_FRAMEDIR,                   RES_FRAMEDIR,                   // [114
        RES_HEADER_FOOTER_EAT_SPACING,  RES_HEADER_FOOTER_EAT_SPACING,  // [115
        RES_UNKNOWNATR_CONTAINER,       RES_UNKNOWNATR_CONTAINER,       // [143

        //UUUU take over DrawingLayer FillStyles
        XATTR_FILL_FIRST,               XATTR_FILL_LAST,                // [1014

        0};

    const SfxPoolItem* pItem;
    for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 )
    {
        for( sal_uInt16 nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId )
        {
            // --> FME 2005-04-18 #i45539#
            // bPage == true:
            // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
            // bPage == false:
            // All in aIdArr except from RES_COL and RES_PAPER_BIN:
            // <--
            if( (  bPage && RES_HEADER_FOOTER_EAT_SPACING != nId ) ||
                ( !bPage && RES_COL != nId && RES_PAPER_BIN != nId ))
            bool bExecuteId(true);

            if(bPage)
            {
                if( SFX_ITEM_SET == rSource.GetItemState( nId, sal_False, &pItem ))
                    rDest.SetFmtAttr( *pItem );
                // When Page
                switch(nId)
                {
                    // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
                    case RES_HEADER_FOOTER_EAT_SPACING:
                    //UUUU take out SvxBrushItem; it's the result of the fallback
                    // at SwFmt::GetItemState and not really in state SFX_ITEM_SET
                    case RES_BACKGROUND:
                        bExecuteId = false;
                        break;
                    default:
                        break;
                }
            }
            else
            {
                // When not Page
                switch(nId)
                {
                    // When not Page: All in aIdArr except from RES_COL and RES_PAPER_BIN:
                    case RES_COL:
                    case RES_PAPER_BIN:
                        bExecuteId = false;
                        break;
                    default:
                        break;
                }
            }

            if(bExecuteId)
            {
                if(SFX_ITEM_SET == rSource.GetItemState(nId,sal_False,&pItem))
                {
                    rDest.SetFmtAttr(*pItem);
                }
                else
                    rDest.ResetFmtAttr( nId );
                {
                    rDest.ResetFmtAttr(nId);
                }
            }
        }
    }
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index bdd8ebb..c14e98f 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -599,35 +599,6 @@ void SwDoc::InitDrawModel()
    if ( pDrawModel )
        ReleaseDrawModel();

//UUUU
//  //DrawPool und EditEnginePool anlegen, diese gehoeren uns und werden
//  //dem Drawing nur mitgegeben. Im ReleaseDrawModel werden die Pools wieder
//  //zerstoert.
//  // 17.2.99: for Bug 73110 - for loading the drawing items. This must
//  //                          be loaded without RefCounts!
//  SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
//  // #75371# change DefaultItems for the SdrEdgeObj distance items
//  // to TWIPS.
//  if(pSdrPool)
//  {
//      const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips
//      pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
//      pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
//      pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
//      pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
//
//      // #i33700#
//      // Set shadow distance defaults as PoolDefaultItems. Details see bug.
//      pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127));
//      pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127));
//  }
//  SfxItemPool *pEEgPool = EditEngine::CreatePool( sal_False );
//  pSdrPool->SetSecondaryPool( pEEgPool );
//  if ( !GetAttrPool().GetFrozenIdRanges () )
//      GetAttrPool().FreezeIdRanges();
//  else
//      pSdrPool->FreezeIdRanges();

    // SJ: #95129# set FontHeight pool defaults without changing static SdrEngineDefaults
     GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));

@@ -847,20 +818,7 @@ void SwDoc::ReleaseDrawModel()
    if ( pDrawModel )
    {
        //!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!!

        delete pDrawModel; pDrawModel = 0;
//UUUU
//      SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
//
//      ASSERT( pSdrPool, "missing Pool" );
//      SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
//      ASSERT( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools");
//      pSdrPool->Delete();                 //Erst die Items vernichten lassen,
//                                          //dann erst die Verkettung loesen
//      GetAttrPool().SetSecondaryPool( 0 );    //Der ist ein muss!
//      pSdrPool->SetSecondaryPool( 0 );    //Der ist sicherer
//      SfxItemPool::Free(pSdrPool);
//      SfxItemPool::Free(pEEgPool);
    }
}

diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index d8f1008..883cb54 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -844,7 +844,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
                                ? pNode->GetpSwpHints()->Count() : 0;
    if( nOldAttrCnt != nNewAttrCnt )
    {
        SwUpdateAttr aHint( 0, 0, 0 );
        SwUpdateAttr aHint(
            0,
            0,
            0);

        pNode->ModifyBroadcast( 0, &aHint, TYPE( SwCrsrShell ) );
    }

diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index dca4c70..1f37b97 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -505,13 +505,7 @@ sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
        pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) );
    }

    //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex
    // and evtl. correct that item to ensure unique names for that type. This call may
    // modify/correct entries inside of the given SfxItemSet
    CheckForUniqueItemForLineFillNameOrIndex(rSet);

    bool const bRet =
        lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet);
    bool const bRet = lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet);

    if ( pSaveUndo.get() )
    {
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index f094190..d7f2dbd 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -590,7 +590,8 @@ static bool lcl_InsAttr(
                    || isPARATR_LIST(nWhich)
                    || isFRMATR(nWhich)
                    || isGRFATR(nWhich)
                    || isUNKNOWNATR(nWhich) )
                    || isUNKNOWNATR(nWhich)
                    || isDrawingLayerAttribute(nWhich) ) //UUUU
            {
                pOtherSet = &rChgSet;
                bOtherAttr = true;
@@ -617,6 +618,10 @@ static bool lcl_InsAttr(
                                    RES_FRMATR_BEGIN, RES_FRMATR_END-1,
                                    RES_GRFATR_BEGIN, RES_GRFATR_END-1,
                                    RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,

                                    //UUUU FillAttribute support
                                    XATTR_FILL_FIRST, XATTR_FILL_LAST,

                                    0 );

        pTmpCharItemSet->Put( rChgSet );
@@ -921,7 +926,14 @@ static bool lcl_InsAttr(
        if( pOtherSet && pOtherSet->Count() )
        {
            SwRegHistory aRegH( pNode, *pNode, pHistory );
            bRet = pNode->SetAttr( *pOtherSet ) || bRet;

            //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex
            // and evtl. correct that item to ensure unique names for that type. This call may
            // modify/correct entries inside of the given SfxItemSet
            SfxItemSet aTempLocalCopy(*pOtherSet);

            pDoc->CheckForUniqueItemForLineFillNameOrIndex(aTempLocalCopy);
            bRet = pNode->SetAttr(aTempLocalCopy) || bRet;
        }

        DELETECHARSETS
@@ -1309,7 +1321,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet )
        {
            aCallMod.Add( pDfltGrfFmtColl );
        }
        else if (isFRMATR(nWhich))
        else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) ) //UUUU
        {
            aCallMod.Add( pDfltGrfFmtColl );
            aCallMod.Add( pDfltTxtFmtColl );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index ab3bd93..53b5eb6 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -119,6 +119,8 @@
#include <sfx2/Metadatable.hxx>
#include <fmtmeta.hxx> // MetaFieldManager

//UUUU
#include <svx/xfillit0.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::document;
@@ -303,6 +305,21 @@ SwDoc::SwDoc()
{
    RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwDoc::SwDoc" );

    //UUUU The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool
    // has a default for the XFillStyleItem of XFILL_SOLID and the color for it is the default
    // fill color (blue7 or similar). This is a problem, in Writer we want the default fill
    // style to be XFILL_NONE. This cannot simply be done by changing it in the 2nd pool at the
    // pool defaults when the DrawingLayer ItemPool is used for Writer, that would lead to
    // countless problems like DrawObjects initial fill and others.
    // It is also hard to find all places where the initial ItemSets for Writer (including
    // style hierarchies) are created and to always set (but only at the root) the FillStyle
    // to NONE fixed; that will add that attribute to the file format. It will be hard to reset
    // attribbute sets (which is done at import and using UI). Also not a good solution.
    // Luckily Writer uses pDfltTxtFmtColl as default parent for all paragraphs and similar, thus
    // it is possible to set this attribute here. It will be not reset when importing.
    pDfltTxtFmtColl->SetFmtAttr(XFillStyleItem(XFILL_NONE));
    pDfltFrmFmt->SetFmtAttr(XFillStyleItem(XFILL_NONE));

    mbGlossDoc =
    mbModified =
    mbDtor =
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 29861ad..fb3ae5f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -3275,16 +3275,23 @@ void SwRedline::InvalidateRange()       // das Layout anstossen
        nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
    }

    SwUpdateAttr aHt( 0, 0, RES_FMT_CHG );
    SwNodes& rNds = GetDoc()->GetNodes();
    SwNode* pNd;
    for( sal_uLong n = nSttNd; n <= nEndNd; ++n )
        if( ND_TEXTNODE == ( pNd = rNds[ n ] )->GetNodeType() )

    for(sal_uLong n(nSttNd); n <= nEndNd; ++n)
    {
        SwNode* pNode = rNds[n];

        if(pNode && ND_TEXTNODE == pNode->GetNodeType())
        {
            aHt.nStart = n == nSttNd ? nSttCnt : 0;
            aHt.nEnd = n == nEndNd ? nEndCnt : ((SwTxtNode*)pNd)->GetTxt().Len();
            ((SwTxtNode*)pNd)->ModifyNotification( &aHt, &aHt );
            SwTxtNode* pNd = static_cast< SwTxtNode* >(pNode);
            SwUpdateAttr aHt(
                n == nSttNd ? nSttCnt : 0,
                n == nEndNd ? nEndCnt : pNd->GetTxt().Len(),
                RES_FMT_CHG);

            pNd->ModifyNotification(&aHt, &aHt);
        }
    }
}

/*************************************************************************
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 4400330..95eb23c 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -236,7 +236,7 @@ void lcl_ClearArea( const SwFrm &rFrm,
        const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;

        //UUUU
        FillAttributesPtr aFillAttributes;
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

        if ( rFrm.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, sal_False ) )
        {
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 55bb550..4467076 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -70,6 +70,8 @@
#include <GetMetricVal.hxx>
#include <numrule.hxx>

//UUUU
#include <svx/xfillit0.hxx>

using namespace ::com::sun::star;

@@ -403,6 +405,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
                aSet.Put(aScriptSpace);
            }
        }

        break;

    case RES_POOLCOLL_TEXT:                 // Textkoerper
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index 92d9184..50278c1 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -83,12 +83,14 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
                    bUnLockView = !pESh->IsViewLocked();
                    pESh->LockView( sal_True );
                }
                const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
                const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid(false);
                const SwTxtAttr* pAttr = pTxtAttr;
                SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
                                          *pAttr->End(),
                                          RES_FMT_CHG );
                ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
                SwUpdateAttr aUpdateAttr(
                    *pAttr->GetStart(),
                    *pAttr->End(),
                    RES_FMT_CHG);

                const_cast< SwTxtNode* >(pTxtNd)->ModifyNotification(&aUpdateAttr, &aUpdateAttr);
            }

        if( bAction )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 51ee292..1f95e14 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1119,7 +1119,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV
    case RES_UPDATE_ATTR:
        if( GetNodes().IsDocNodes() && IsTxtNode() )
        {
            const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr;
            const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->getWhichAttr();
            if ( RES_ATTRSET_CHG == nTmp )
            {
                // anybody wants to do some optimization here?
@@ -2087,6 +2087,12 @@ SwOLENodes* SwCntntNode::CreateOLENodesArray( const SwFmtColl& rColl, bool bOnly
    return pNodes;
}

//UUUU
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwCntntNode::getSdrAllFillAttributesHelper() const
{
    return drawinglayer::attribute::SdrAllFillAttributesHelperPtr();
}

//FEATURE::CONDCOLL
// Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
// os: nur fuer ICC, da der zum optimieren zu dumm ist
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 7c4d2b0..bc56828 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -59,8 +59,6 @@ class SwFmt;
class SwPrintData;
class SwSortedObjs;
class SwAnchoredObject;
//UUUU
class FillAttributes;

//Jeder FrmTyp findet sich hier in einem Bit wieder.
//Die Bits muessen so gesetzt werden, dass mit einer Maskierung festgestellt
@@ -273,6 +271,12 @@ enum MakePageType
//typedef SdrObject* SdrObjectPtr;
//SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1);

//UUUU
namespace drawinglayer { namespace attribute {
    class SdrAllFillAttributesHelper;
    typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
}}

class SwFrm: public SwClient, public SfxBroadcaster
{
    //Der verkappte Frm
@@ -576,7 +580,7 @@ public:
    void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const;

    sal_Bool GetBackgroundBrush(
        boost::shared_ptr< FillAttributes >& rFillAttributes,
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
        const SvxBrushItem*& rpBrush,
        const Color*& rpColor,
        SwRect &rOrigRect,
@@ -967,6 +971,9 @@ public:
    bool KnowsFormat( const SwFmt& rFmt ) const;
    void RegisterToFormat( SwFmt& rFmt );
    void ValidateThisAndAllLowers( const sal_uInt16 nStage );

    //UUUU
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
};

inline sal_Bool SwFrm::IsInDocBody() const
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index bbea276..3d8adcc 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -71,7 +71,7 @@ void MA_FASTCALL DrawGraphic(
    const sal_uInt8 nGrfNum = GRFNUM_NO,
    const sal_Bool bConsiderBackgroundTransparency = sal_False );
bool MA_FASTCALL DrawFillAttributes(
    const boost::shared_ptr< FillAttributes >& rFillAttributes,
    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
    const SwRect& rOriginalLayoutRect,
    const SwRect& rPaintRect,
    OutputDevice& rOut);
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index fdbd379..1ea5e09 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -373,9 +373,11 @@ public:
    bool TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool ToFirst = true );

    // --> OD 2008-02-27 #refactorlists# - removed <rDoc>
    void Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
              sal_uLong nNodeIdx );
    // <--
    void Add(
        const SfxPoolItem* pOldValue,
        const SfxPoolItem* pNewValue,
        sal_uLong nNodeIdx);

    void Add( SwTxtAttr* pTxtHt, sal_uLong nNodeIdx, bool bNewAttr = true );
    void Add( SwFmtColl*, sal_uLong nNodeIdx, sal_uInt8 nWhichNd );
    void Add( const ::sw::mark::IMark&, bool bSavePos, bool bSaveOtherPos );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 64d9aa8..fa28d8c 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -109,7 +109,7 @@
#include <pagedeschint.hxx>

//UUUU
#include <fillattributes.hxx>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <svx/xfillit0.hxx>

using namespace ::com::sun::star;
@@ -2493,23 +2493,6 @@ SwFrmFmt::SwFrmFmt(
    maFillAttributes(),
    pCaptionFmt(0)
{
    //UUUU
    if(RES_FLYFRMFMT == nFmtWhich)
    {
        // when its a SwFlyFrmFmt do not do this, this setting
        // will be derived from the parent style. In the future this
        // may be needed for more formats; all which use the
        // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes
#ifdef DBG_UTIL
        bool bBla = true; // allow setting a breakpoint here in debug mode
#endif
    }
    else
    {
        // set FillStyle to none; this is necessary since the pool default is
        // to fill objects by color (blue8)
        SetFmtAttr(XFillStyleItem(XFILL_NONE));
    }
}

SwFrmFmt::SwFrmFmt(
@@ -2523,23 +2506,6 @@ SwFrmFmt::SwFrmFmt(
    maFillAttributes(),
    pCaptionFmt(0)
{
    //UUUU
    if(RES_FLYFRMFMT == nFmtWhich)
    {
        // when its a SwFlyFrmFmt do not do this, this setting
        // will be derived from the parent style. In the future this
        // may be needed for more formats; all which use the
        // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes
#ifdef DBG_UTIL
        bool bBla = true; // allow setting a breakpoint here in debug mode
#endif
    }
    else
    {
        // set FillStyle to none; this is necessary since the pool default is
        // to fill objects by color (blue8)
        SetFmtAttr(XFillStyleItem(XFILL_NONE));
    }
}

void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
@@ -2557,7 +2523,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
            RES_FOOTER, sal_False, (const SfxPoolItem**)&pF );

        //UUUU reset fill information
        if(RES_FLYFRMFMT == Which() && maFillAttributes.get())
        if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
        {
            SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet());
            bool bReset(false);
@@ -2573,10 +2539,10 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
            }
        }
    }
    else if(RES_FMT_CHG == nWhich) //UUUU
    else if(RES_FMT_CHG == nWhich)
    {
        //UUUU reset fill information on format change (e.g. style changed)
        if(RES_FLYFRMFMT == Which() && maFillAttributes.get())
        if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
        {
            maFillAttributes.reset();
        }
@@ -3120,9 +3086,9 @@ const String SwFlyFrmFmt::GetObjDescription() const
sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
{
    //UUUU
    if(RES_FLYFRMFMT == Which() && getFillAttributes())
    if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper())
    {
        return getFillAttributes()->isTransparent();
        return getSdrAllFillAttributesHelper()->isTransparent();
    }

    /// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
@@ -3164,9 +3130,9 @@ sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
sal_Bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
{
    //UUUU
    if(RES_FLYFRMFMT == Which() && getFillAttributes())
    if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper())
    {
        return !getFillAttributes()->isUsed();
        return !getSdrAllFillAttributesHelper()->isUsed();
    }
    else if ( (GetBackground().GetColor() == COL_TRANSPARENT) &&
         !(GetBackground().GetGraphicObject()) )
@@ -3409,20 +3375,20 @@ SwFrmFmt* SwFrmFmt::GetCaptionFmt() const
}

//UUUU
FillAttributesPtr SwFrmFmt::getFillAttributes() const
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrmFmt::getSdrAllFillAttributesHelper() const
{
    if(RES_FLYFRMFMT == Which())
    if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
    {
        // create FillAttributes on demand
        if(!maFillAttributes.get())
        {
            const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new FillAttributes(GetAttrSet()));
            const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetAttrSet()));
        }
    }
    else
    {
        // FALLBACKBREAKHERE assert wrong usage
        OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)");
        OSL_ENSURE(false, "getSdrAllFillAttributesHelper() call only valid for RES_FLYFRMFMT and RES_FRMFMT (!)");
    }

    return maFillAttributes;
diff --git a/sw/source/core/layout/fillattributes.cxx b/sw/source/core/layout/fillattributes.cxx
deleted file mode 100755
index e8d1877b..0000000
--- a/sw/source/core/layout/fillattributes.cxx
+++ /dev/null
@@ -1,168 +0,0 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

#include <fillattributes.hxx>
#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <drawinglayer/attribute/fillhatchattribute.hxx>
#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
#include <svx/xfillit0.hxx>
#include <vcl/graph.hxx>


//////////////////////////////////////////////////////////////////////////////

void FillAttributes::createPrimitive2DSequence(
    const basegfx::B2DRange& rPaintRange,
    const basegfx::B2DRange& rDefineRange)
{
    // reset and remember new target range for object geometry
    maLastPaintRange = rPaintRange;
    maLastDefineRange = rDefineRange;

    if(isUsed())
    {
        maPrimitives.realloc(1);
        maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
            basegfx::B2DPolyPolygon(
                basegfx::tools::createPolygonFromRect(
                    maLastPaintRange)),
                maLastDefineRange,
            maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(),
            maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute());
    }
}

FillAttributes::FillAttributes()
:   maLastPaintRange(),
    maLastDefineRange(),
    maFillAttribute(),
    maFillGradientAttribute(),
    maPrimitives()
{
}

FillAttributes::FillAttributes(const Color& rColor)
:   maLastPaintRange(),
    maLastDefineRange(),
    maFillAttribute(),
    maFillGradientAttribute(),
    maPrimitives()
{
    maFillAttribute.reset(
        new drawinglayer::attribute::SdrFillAttribute(
            0.0,
            Color(rColor.GetRGBColor()).getBColor(),
            drawinglayer::attribute::FillGradientAttribute(),
            drawinglayer::attribute::FillHatchAttribute(),
            drawinglayer::attribute::SdrFillGraphicAttribute()));
}

FillAttributes::FillAttributes(const SfxItemSet& rSet)
:   maLastPaintRange(),
    maLastDefineRange(),
    maFillAttribute(
        new drawinglayer::attribute::SdrFillAttribute(
            drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))),
    maFillGradientAttribute(
        new drawinglayer::attribute::FillGradientAttribute(
            drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))),
    maPrimitives()
{
}

FillAttributes::~FillAttributes()
{
}

bool FillAttributes::isUsed() const
{
    // only depends on fill, FillGradientAttribute alone defines no fill
    return maFillAttribute.get() && !maFillAttribute->isDefault();
}

bool FillAttributes::isTransparent() const
{
    if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
    {
        return true;
    }

    if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault())
    {
        return true;
    }

    if(hasSdrFillAttribute())
    {
        const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic();

        return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent();
    }

    return false;
}

const drawinglayer::attribute::SdrFillAttribute& FillAttributes::getFillAttribute() const
{
    if(!maFillAttribute.get())
    {
        const_cast< FillAttributes* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute());
    }

    return *maFillAttribute.get();
}

const drawinglayer::attribute::FillGradientAttribute& FillAttributes::getFillGradientAttribute() const
{
    if(!maFillGradientAttribute.get())
    {
        const_cast< FillAttributes* >(this)->maFillGradientAttribute.reset(new drawinglayer::attribute::FillGradientAttribute());
    }

    return *maFillGradientAttribute.get();
}

const drawinglayer::primitive2d::Primitive2DSequence& FillAttributes::getPrimitive2DSequence(
    const basegfx::B2DRange& rPaintRange,
    const basegfx::B2DRange& rDefineRange) const
{
    if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange))
    {
        const_cast< FillAttributes* >(this)->maPrimitives.realloc(0);
    }

    if(!maPrimitives.getLength())
    {
        const_cast< FillAttributes* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
    }

    return maPrimitives;
}

//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 175e6a9..e213e1c 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -658,6 +658,19 @@ const SwAttrSet* SwFrm::GetAttrSet() const
        return &((const SwLayoutFrm*)this)->GetFmt()->GetAttrSet();
}

//UUUU
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrm::getSdrAllFillAttributesHelper() const
{
    if(IsCntntFrm())
    {
        return static_cast< const SwCntntFrm* >(this)->GetNode()->getSdrAllFillAttributesHelper();
    }
    else
    {
        return static_cast< const SwLayoutFrm* >(this)->GetFmt()->getSdrAllFillAttributesHelper();
    }
}

/*************************************************************************
|*
|*  SwFrm::_FindNext(), _FindPrev(), InvalidateNextPos()
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index e7768a0..7250b8c 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -81,6 +81,9 @@
#include <objectformatter.hxx>
#include <switerator.hxx>

//UUUU
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>

// ftnfrm.cxx:
void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes );

@@ -226,9 +229,23 @@ SwFrmNotify::~SwFrmNotify()
            (aPrt.*fnRect->fnGetHeight)()!=(pFrm->Prt().*fnRect->fnGetHeight)();
    if ( bPrtWidth || bPrtHeight )
    {
        const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos();
        if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
            pFrm->SetCompletePaint();
        //UUUU
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pFrm->getSdrAllFillAttributesHelper());

        if(aFillAttributes.get() && aFillAttributes->isUsed())
        {
            //UUUU use SetCompletePaint if needed
            if(aFillAttributes->needCompleteRepaint())
            {
                pFrm->SetCompletePaint();
            }
        }
        else
        {
            const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos();
            if(GPOS_NONE != ePos && GPOS_TILED != ePos)
                pFrm->SetCompletePaint();
        }
    }
    else
    {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e18a8ae..318986e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -96,7 +96,9 @@
#include <vcl/svapp.hxx>

//UUUU
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <ndtxt.hxx>

#define COL_NOTES_SIDEPANE                  RGB_COLORDATA(230,230,230)
#define COL_NOTES_SIDEPANE_BORDER           RGB_COLORDATA(200,200,200)
@@ -1637,7 +1639,7 @@ void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
} // end of method <lcl_DrawGraphic>

bool MA_FASTCALL DrawFillAttributes(
    const FillAttributesPtr& rFillAttributes,
    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
    const SwRect& rOriginalLayoutRect,
    const SwRect& rPaintRect,
    OutputDevice& rOut)
@@ -1647,9 +1649,12 @@ bool MA_FASTCALL DrawFillAttributes(

    if(bUseNew && rFillAttributes.get() && rFillAttributes->isUsed())
    {
        //UUUU Need to substract a half logical pixel unit from TopLeft to get the correct
        // layering for AAed paints
        const basegfx::B2DVector aHalfSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(0.5, 0.5));
        const basegfx::B2DRange aPaintRange(
            rPaintRect.Left(),
            rPaintRect.Top(),
            rPaintRect.Left() - aHalfSingleUnit.getX(),
            rPaintRect.Top() - aHalfSingleUnit.getY(),
            rPaintRect.Right(),
            rPaintRect.Bottom());

@@ -3412,7 +3417,7 @@ sal_Bool SwFlyFrm::IsBackgroundTransparent() const
        SwRect aDummyRect;

        //UUUU
        FillAttributesPtr aFillAttributes;
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

        if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false) )
        {
@@ -3663,10 +3668,10 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
        {
            const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(GetFmt());

            if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which())
            if(pSwFrmFmt && (RES_FLYFRMFMT == pSwFrmFmt->Which() || RES_FRMFMT == pSwFrmFmt->Which()))
            {
                //UUUU check for transparency
                const FillAttributesPtr aFillAttributes(pSwFrmFmt->getFillAttributes());
                const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrmFmt->getSdrAllFillAttributesHelper());

                // check if the new fill attributes are used
                if(aFillAttributes.get() && aFillAttributes->isUsed())
@@ -5384,48 +5389,26 @@ void SwPageFrm::PaintGrid( OutputDevice* pOut, SwRect &rRect ) const
void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
                                 ViewShell* _pViewShell ) const
{
    if (  _pViewShell->GetWin() &&
         !_pViewShell->GetViewOptions()->getBrowseMode() )
    if (  _pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode() )
    {
        SwRect aPgPrtRect( Prt() );
        aPgPrtRect.Pos() += Frm().Pos();
        if ( !aPgPrtRect.IsInside( _rOutputRect ) )
        //UUUU Simplified paint with DrawingLayer FillStyle
        SwRect aPgRect = Frm();
        aPgRect._Intersection( _rOutputRect );

        if(!aPgRect.IsEmpty())
        {
            SwRect aPgRect = Frm();
            aPgRect._Intersection( _rOutputRect );
            SwRegionRects aPgRegion( aPgRect );
            aPgRegion -= aPgPrtRect;
            const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this);
            //if ( pPage->GetSortedObjs() )
            //    ::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion );
            if ( aPgRegion.Count() )
            OutputDevice *pOut = _pViewShell->GetOut();

            if(pOut->GetFillColor() != aGlobalRetoucheColor)
            {
                OutputDevice *pOut = _pViewShell->GetOut();
                if ( pOut->GetFillColor() != aGlobalRetoucheColor )
                    pOut->SetFillColor( aGlobalRetoucheColor );
                for ( sal_uInt16 i = 0; i < aPgRegion.Count(); ++i )
                {
                    if ( 1 < aPgRegion.Count() )
                    {
                        ::SwAlignRect( aPgRegion[i], pGlobalShell );
                        if( !aPgRegion[i].HasArea() )
                            continue;
                    }
                    pOut->DrawRect(aPgRegion[i].SVRect());
                }
                pOut->SetFillColor(aGlobalRetoucheColor);
            }

            pOut->DrawRect(aPgRect.SVRect());
        }
    }
}

// ----------------------------------------------------------------------
//
// const SwPageFrm::mnBorderPxWidth, const SwPageFrm::mnShadowPxWidth
// SwPageFrm::GetBorderRect (..), SwPageFrm::GetRightShadowRect(..),
// SwPageFrm::GetBottomShadowRect(..),
// SwPageFrm::PaintBorderAndShadow(..),
// SwPageFrm::GetBorderAndShadowBoundRect(..)
//
// OD 12.02.2003 for #i9719# and #105645#
// ----------------------------------------------------------------------

@@ -5828,7 +5811,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
    sal_Bool bLowMode = sal_True;

    //UUUU
    FillAttributesPtr aFillAttributes;
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

    sal_Bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode );

@@ -5861,14 +5844,14 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                pTmpBackBrush = new SvxBrushItem( Color( COL_WHITE ), RES_BACKGROUND );

                //UUU
                aFillAttributes.reset(new FillAttributes(Color( COL_WHITE )));
                aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(Color( COL_WHITE )));
            }
            else
            {
                pTmpBackBrush = new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND);

                //UUU
                aFillAttributes.reset(new FillAttributes(aGlobalRetoucheColor));
                aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aGlobalRetoucheColor));
            }

            pItem = pTmpBackBrush;
@@ -5919,7 +5902,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
                    pItem = pNewItem;

                    //UUUU
                    aFillAttributes.reset(new FillAttributes(*pCol));
                    aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol));
                }

                //if ( pPage->GetSortedObjs() )
@@ -6508,24 +6491,32 @@ const Color& SwPageFrm::GetDrawBackgrdColor() const
    SwRect aDummyRect;

    //UUUU
    FillAttributesPtr aFillAttributes;
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

    if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true) )
    {
        const Graphic* pGraphic = pBrushItem->GetGraphic();

        if(pGraphic)
        if(aFillAttributes.get() && aFillAttributes->isUsed()) //UUUU
        {
            // #29105# when a graphic is set, it may be possible to calculate a single
            // color which looks good in all places of the graphic. Since it is
            // planned to have text edit on the overlay one day and the fallback
            // to aGlobalRetoucheColor returns something useful, just use that
            // for now.
            // let SdrAllFillAttributesHelper do the average color calculation
            return Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor()));
        }
        else
        else if(pBrushItem)
        {
            // not a graphic, use (hopefully) initialized color
            return pBrushItem->GetColor();
            const Graphic* pGraphic = pBrushItem->GetGraphic();

            if(pGraphic)
            {
                // #29105# when a graphic is set, it may be possible to calculate a single
                // color which looks good in all places of the graphic. Since it is
                // planned to have text edit on the overlay one day and the fallback
                // to aGlobalRetoucheColor returns something useful, just use that
                // for now.
            }
            else
            {
                // not a graphic, use (hopefully) initialized color
                return pBrushItem->GetColor();
            }
        }
    }

@@ -6681,7 +6672,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
    @return true, if a background brush for the frame is found
*/
sal_Bool SwFrm::GetBackgroundBrush(
    FillAttributesPtr& rFillAttributes,
    drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
    const SvxBrushItem* & rpBrush,
    const Color*& rpCol,
    SwRect &rOrigRect,
@@ -6697,18 +6688,7 @@ sal_Bool SwFrm::GetBackgroundBrush(
            return sal_False;

        //UUUU
        const SwLayoutFrm* pSwLayoutFrm = dynamic_cast< const SwLayoutFrm* >(pFrm);

        if(pSwLayoutFrm)
        {
            const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(pSwLayoutFrm->GetFmt());

            if(pSwFrmFmt  && RES_FLYFRMFMT == pSwFrmFmt->Which())
            {
                rFillAttributes = pSwFrmFmt->getFillAttributes();
            }
        }

        rFillAttributes = pFrm->getSdrAllFillAttributesHelper();
        const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground();

        if( pFrm->IsSctFrm() )
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 5291793..d964c6a 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -610,7 +610,7 @@ sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
        SwRect aOrigBackRect;

        //UUUU
        FillAttributesPtr aFillAttributes;
        drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

        /// OD 21.08.2002
        ///     consider, that [GetBackgroundBrush(...)] can set <pCol>
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a5d5ecc..f4a5b09 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1040,8 +1040,8 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
        break;
        case RES_UPDATE_ATTR:
        {
            nPos = ((SwUpdateAttr*)pNew)->nStart;
            nLen = ((SwUpdateAttr*)pNew)->nEnd - nPos;
            nPos = ((SwUpdateAttr*)pNew)->getStart();
            nLen = ((SwUpdateAttr*)pNew)->getEnd() - nPos;
            if( IsIdxInside( nPos, nLen ) )
            {
                // Es muss in jedem Fall neu formatiert werden,
@@ -1054,7 +1054,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                    nLen = 1;

                _InvalidateRange( SwCharRange( nPos, nLen) );
                MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr;
                MSHORT nTmp = ((SwUpdateAttr*)pNew)->getWhichAttr();

                if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
                    RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 4dd41ef..69a118f 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2671,7 +2671,7 @@ sal_Bool SwDrawTextInfo::ApplyAutoColor( Font* pFont )
                SwRect aOrigBackRect;

                //UUUU
                FillAttributesPtr aFillAttributes;
                drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;

                /// OD 21.08.2002
                ///     consider, that [GetBackgroundBrush(...)] can set <pCol>
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 13f3213..75b2aa0 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -91,6 +91,9 @@
#include <switerator.hxx>
#include <attrhint.hxx>

//UUUU
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
#include <svl/itemiter.hxx>

using namespace ::com::sun::star;

@@ -205,21 +208,23 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere,
// SwTxtNode
// --------------------

SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
                      SwTxtFmtColl *pTxtColl,
                      const SfxItemSet* pAutoAttr )
    : SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ),
      m_pSwpHints( 0 ),
      mpNodeNum( 0 ),
      m_bLastOutlineState( false ),
      m_bNotifiable( false ),
      // --> OD 2008-11-19 #i70748#
      mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ),
      // <--
      // --> OD 2008-05-06 #refactorlists#
      mbInSetOrResetAttr( false ),
      mpList( 0 )
      // <--
SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr )
:   SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ),
    m_pSwpHints( 0 ),
    mpNodeNum( 0 ),
    m_Text(),
    m_pParaIdleData_Impl(0),
    m_bContainsHiddenChars(false),
    m_bHiddenCharsHidePara(false),
    m_bRecalcHiddenCharFlags(false),
    m_bLastOutlineState( false ),
    m_bNotifiable( false ),
    mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ),
    mbInSetOrResetAttr( false ),
    mpList( 0 ),
    m_pNumStringCache(),
    m_wXParagraph(),
    maFillAttributes()
{
    InitSwParaStatistics( true );

@@ -1545,7 +1550,11 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
    if( this != pDest )
    {
        // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern
        SwUpdateAttr aHint( nOldPos, nOldPos, 0 );
        SwUpdateAttr aHint(
            nOldPos,
            nOldPos,
            0);

        pDest->ModifyNotification( 0, &aHint );
    }
}
@@ -2466,7 +2475,11 @@ void SwTxtNode::GCAttr()
    if(bChanged)
    {
        //TxtFrm's reagieren auf aHint, andere auf aNew
        SwUpdateAttr aHint( nMin, nMax, 0 );
        SwUpdateAttr aHint(
            nMin,
            nMax,
            0);

        NotifyClients( 0, &aHint );
        SwFmtChg aNew( GetTxtColl() );
        NotifyClients( 0, &aNew );
@@ -3649,6 +3662,28 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal
                        (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt );
    }

    //UUUU reset fill information
    if(maFillAttributes.get())
    {
        sal_uInt16 nWhich = pNewValue ? pNewValue->Which() : 0;
        bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style changed)

        if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from DrawingLayer FillAttributes
        {
            SfxItemIter aIter(*((SwAttrSetChg*)pNewValue)->GetChgSet());

            for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
            {
                bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
            }
        }

        if(bReset)
        {
            maFillAttributes.reset();
        }
    }

    // --> OD 2008-03-27 #refactorlists#
    if ( !mbInSetOrResetAttr )
    {
@@ -3699,6 +3734,12 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl )
            HandleModifyAtTxtNode( *this, &aTmp1, &aTmp2  );
        }
        // <--

        //UUUU reset fill information on parent style change
        if(maFillAttributes.get())
        {
            maFillAttributes.reset();
        }
    }

    // nur wenn im normalen Nodes-Array
@@ -5060,3 +5101,16 @@ bool SwTxtNode::HasPageNumberField()
}
//Bug 120881(End)

//UUUU
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTxtNode::getSdrAllFillAttributesHelper() const
{
    // create SdrAllFillAttributesHelper on demand
    if(!maFillAttributes.get())
    {
        const_cast< SwTxtNode* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetSwAttrSet()));
    }

    return maFillAttributes;
}

// eof
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index fd77db9..6a7bdfc 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1677,7 +1677,10 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr )
    {
        // create MsgHint before start/end become invalid
        SwUpdateAttr aHint(
                *pAttr->GetStart(), *pAttr->GetEnd(), pAttr->Which() );
            *pAttr->GetStart(),
            *pAttr->GetEnd(),
            pAttr->Which());

        m_pSwpHints->Delete( pAttr );
        SwTxtAttr::Destroy( pAttr, GetDoc()->GetAttrPool() );
        NotifyClients( 0, &aHint );
@@ -1752,7 +1755,11 @@ void SwTxtNode::DeleteAttributes(
                // Start und End weg.
                // Das CalcVisibleFlag bei HiddenParaFields entfaellt,
                // da dies das Feld im Dtor selbst erledigt.
                SwUpdateAttr aHint( nStart, *pEndIdx, nWhich );
                SwUpdateAttr aHint(
                    nStart,
                    *pEndIdx,
                    nWhich);

                m_pSwpHints->DeleteAtPos( nPos );    // gefunden, loeschen,
                SwTxtAttr::Destroy( pTxtHt, GetDoc()->GetAttrPool() );
                NotifyClients( 0, &aHint );
@@ -3043,11 +3050,16 @@ bool SwpHints::TryInsertHint(
            CHECK;
#endif
        // ... und die Abhaengigen benachrichtigen
        if ( rNode.GetDepends() )
        if(rNode.GetDepends())
        {
            SwUpdateAttr aHint( nHtStart, nHtStart, nWhich );
            rNode.ModifyNotification( 0, &aHint );
            SwUpdateAttr aHint(
                nHtStart,
                nHtStart,
                nWhich);

            rNode.ModifyNotification(0,&aHint);
        }

        return true;
    }

@@ -3127,7 +3139,12 @@ bool SwpHints::TryInsertHint(
    // ... und die Abhaengigen benachrichtigen
    if ( rNode.GetDepends() )
    {
        SwUpdateAttr aHint( nHtStart, nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, nWhich );
        SwUpdateAttr aHint(
            // rNode.GetDoc()->GetAttrPool(),
            nHtStart,
            nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd,
            nWhich);

        rNode.ModifyNotification( 0, &aHint );
    }

diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 061dd9d..e8e786c 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -72,7 +72,11 @@ void SwTxtCharFmt::ModifyNotification( const SfxPoolItem* pOld, const SfxPoolIte

    if ( m_pTxtNode )
    {
        SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
        SwUpdateAttr aUpdateAttr(
            *GetStart(),
            *GetEnd(),
            nWhich);

        m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
    }
}
@@ -190,7 +194,11 @@ void SwTxtINetFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )

    if ( m_pTxtNode )
    {
        SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
        SwUpdateAttr aUpdateAttr(
            *GetStart(),
            *GetEnd(),
            nWhich);

        m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
    }
}
@@ -239,7 +247,11 @@ void SwTxtRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )

    if ( m_pTxtNode )
    {
        SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
        SwUpdateAttr aUpdateAttr(
            *GetStart(),
            *GetEnd(),
            nWhich);

        m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
    }
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 5d0d831..8e77ac6 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -646,14 +646,20 @@ void SwTxtNode::RstTxtAttr(
    }

    TryDeleteSwpHints();

    if (bChanged)
    {
        if ( HasHints() )
        {
            m_pSwpHints->Resort();
        }

        //TxtFrm's reagieren auf aHint, andere auf aNew
        SwUpdateAttr aHint( nMin, nMax, 0 );
        SwUpdateAttr aHint(
            nMin,
            nMax,
            0);

        NotifyClients( 0, &aHint );
        SwFmtChg aNew( GetFmtColl() );
        NotifyClients( 0, &aNew );
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 2f8b42c..7f6722f 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1039,20 +1039,31 @@ SwHistory::~SwHistory()
|*
*************************************************************************/

void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
                     sal_uLong nNodeIdx )
void SwHistory::Add(
    const SfxPoolItem* pOldValue,
    const SfxPoolItem* pNewValue,
    sal_uLong nNodeIdx)
{
    ASSERT( !m_nEndDiff, "History was not deleted after REDO" );
    const sal_uInt16 nWhich(pNewValue->Which());

    sal_uInt16 nWhich = pNewValue->Which();
    if( (nWhich >= POOLATTR_END)
        || (nWhich == RES_TXTATR_FIELD)
        || (nWhich == RES_TXTATR_ANNOTATION) )
    // excluded values
    if(nWhich == RES_TXTATR_FIELD || nWhich == RES_TXTATR_ANNOTATION)
    {
        return;
    }

    // no default Attribute?
    SwHistoryHint * pHt;
    if ( pOldValue && pOldValue != GetDfltAttr( pOldValue->Which() ) )
    SwHistoryHint* pHt = 0;

    //UUUU To be able to include the DrawingLayer FillItems something more
    // general has to be done to check if an Item is default than to check
    // if it's pointzer equals that in Writer's global PoolDefaults (held in
    // aAttrTab and used to fill the pool defaults in Writer - looks as if
    // Writer is *older* than the SfxItemPool ?). I checked the possibility to
    // get the SfxItemPool here (works), but decided to use the SfxPoolItem's
    // global tooling aka IsDefaultItem(const SfxPoolItem*) for now
    if(pOldValue && !IsDefaultItem(pOldValue))
    {
        pHt = new SwHistorySetFmt( pOldValue, nNodeIdx );
    }
@@ -1060,7 +1071,8 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
    {
        pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx );
    }
    m_SwpHstry.Insert( pHt, Count() );

    m_SwpHstry.Insert(pHt, Count());
}


@@ -1275,21 +1287,34 @@ sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd )
    return nOld;
}

void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx )
void SwHistory::CopyFmtAttr(
    const SfxItemSet& rSet,
    sal_uLong nNodeIdx)
{
    if( rSet.Count() )
    if(rSet.Count())
    {
        SfxItemIter aIter( rSet );
        do {
            if( (SfxPoolItem*)-1 != aIter.GetCurItem() )
        SfxItemIter aIter(rSet);

        do
        {
            if(!IsInvalidItem(aIter.GetCurItem()))
            {
                const SfxPoolItem* pNew = aIter.GetCurItem();
                Add( pNew, pNew, nNodeIdx );

                Add(
                    pNew,
                    pNew,
                    nNodeIdx);
            }
            if( aIter.IsAtEnd() )

            if(aIter.IsAtEnd())
            {
                break;
            }

            aIter.NextItem();
        } while( sal_True );

        } while(true);
    }
}

@@ -1380,31 +1405,38 @@ SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst )

void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
    // --> OD 2010-10-05 #i114861#
    // Do not handle a "noop" modify
    // - e.g. <SwTxtNode::NumRuleChgd()> uses such a "noop" modify
//    if ( m_pHistory && ( pOld || pNew ) )
    if ( m_pHistory && ( pOld || pNew ) &&
         pOld != pNew )
    // <--
    if ( m_pHistory && ( pOld || pNew ) && pOld != pNew )
    {
        if ( pNew->Which() < POOLATTR_END )
        {
            m_pHistory->Add( pOld, pNew, m_nNodeIndex );
            if(RES_UPDATE_ATTR == pNew->Which())
            {
                // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool();

                m_pHistory->Add(
                    // rPool,
                    pOld,
                    pNew,
                    m_nNodeIndex);
            }
            else
            {
                OSL_ENSURE(false, "Unexpected update attribute (!)");
            }
        }
        else if ( RES_ATTRSET_CHG == pNew->Which() )
        {
            SwHistoryHint* pNewHstr;
            const SfxItemSet& rSet =
                *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet();
            const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet();

            if ( 1 < rSet.Count() )
            {
                pNewHstr =
                    new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet );
                pNewHstr = new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet );
            }
            else
            {
                const SfxPoolItem* pItem = SfxItemIter( rSet ).FirstItem();

                if ( m_WhichIdSet.Seek_Entry( pItem->Which() ) )
                {
                    pNewHstr = new SwHistorySetFmt( pItem, m_nNodeIndex );
@@ -1414,6 +1446,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
                    pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex );
                }
            }

            m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
        }
    }
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 6d1711a..cf59ea7 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

@@ -31,9 +29,7 @@
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#ifndef _COM_SUN_STAR_UCB_NAMECLASH_HDL_
#include <com/sun/star/ucb/NameClash.hdl>
#endif
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -50,7 +46,12 @@
#include <swunodef.hxx>
#include <errhdl.hxx>

namespace SWUnoHelper {
//UUUU
#include <svx/xfillit0.hxx>
#include <svl/itemset.hxx>

namespace SWUnoHelper
{

sal_Int32 GetEnumAsInt32( const UNO_NMSPC::Any& rVal )
{
@@ -284,4 +285,34 @@ sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
    return bOk;
}

//UUUU
bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet)
{
    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rSet.GetItem(XATTR_FILLSTYLE, false)));

    if(!pXFillStyleItem)
    {
        return false;
    }

    // here different FillStyles can be excluded for export; it will depend on the
    // quality these fallbacks can reach. That again is done in getSvxBrushItemFromSourceSet,
    // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem.
    // For now, take them all - except XFILL_NONE

    if(XFILL_NONE != pXFillStyleItem->GetValue())
    {
        return true;
    }

    // if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue())
    // {
    //     return true;
    // }

    return false;
}

}

// eof
diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx b/sw/source/core/unocore/unobrushitemhelper.cxx
deleted file mode 100644
index 5d790b2..0000000
--- a/sw/source/core/unocore/unobrushitemhelper.cxx
+++ /dev/null
@@ -1,328 +0,0 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

#include <unobrushitemhelper.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xgrscit.hxx>
#include <svx/xflbmtit.hxx>
#include <svx/xflbmpit.hxx>
#include <svx/xflbmsxy.hxx>
#include <svx/xflbmsxy.hxx>
#include <svx/xflftrit.hxx>
#include <svx/xsflclit.hxx>
#include <svx/xflbmsli.hxx>
#include <svx/xflbtoxy.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflboxy.hxx>
#include <svx/xflbckit.hxx>
#include <svx/xflclit.hxx>
#include <svx/xfltrit.hxx>
#include <svx/xflhtit.hxx>
#include <svx/unoshape.hxx>
#include <hintids.hxx>

//UUUU
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet)
{
    if(0xff != rBrush.GetColor().GetTransparency())
    {
        const Color aColor(rBrush.GetColor().GetRGBColor());
        const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency());

        rToSet.Put(XFillStyleItem(XFILL_SOLID));
        rToSet.Put(XFillColorItem(String(), aColor));

        if(0xff != nTransparency)
        {
            // nTransparency is in range [0..255]
            rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255));
        }
    }
    else if(GPOS_NONE != rBrush.GetGraphicPos())
    {
        const Graphic* pGraphic = rBrush.GetGraphic();

        if(pGraphic)
        {
            // set fill style and graphic itself
            rToSet.Put(XFillStyleItem(XFILL_BITMAP));
            rToSet.Put(XFillBitmapItem(String(), *pGraphic));

            // set defaults
            // already pool default rToSet.Put(XFillBmpPosItem(RP_MM));
            // already pool default rToSet.Put(XFillBmpTileOffsetXItem(0));
            // already pool default rToSet.Put(XFillBmpTileOffsetYItem(0));
            // already pool default rToSet.Put(XFillBmpPosOffsetXItem(0));
            // already pool default rToSet.Put(XFillBmpPosOffsetYItem(0));
            // already pool default rToSet.Put(XFillBmpSizeLogItem(true));
            // already pool default rToSet.Put(XFillBmpSizeXItem(0));
            // already pool default rToSet.Put(XFillBmpSizeYItem(0));

            if(GPOS_AREA == rBrush.GetGraphicPos())
            {
                // stretch, also means no tile (both items are defaulted to true)
                // rToSet.Put(XFillBmpStretchItem(true));
                rToSet.Put(XFillBmpTileItem(false));

                // default for strech is also top-left, but this will not be visible
                // rToSet.Put(XFillBmpPosItem(RP_LT));
            }
            else if(GPOS_TILED == rBrush.GetGraphicPos())
            {
                // tiled, also means no stretch (both items are defaulted to true)
                rToSet.Put(XFillBmpStretchItem(false));
                //rToSet.Put(XFillBmpTileItem(true));

                // default for tiled is top-left
                rToSet.Put(XFillBmpPosItem(RP_LT));
            }
            else
            {
                // everything else means no tile and no stretch
                rToSet.Put(XFillBmpStretchItem(false));
                rToSet.Put(XFillBmpTileItem(false));

                switch(rBrush.GetGraphicPos())
                {
                    case GPOS_LT: rToSet.Put(XFillBmpPosItem(RP_LT)); break;
                    case GPOS_MT: rToSet.Put(XFillBmpPosItem(RP_MT)); break;
                    case GPOS_RT: rToSet.Put(XFillBmpPosItem(RP_RT)); break;
                    case GPOS_LM: rToSet.Put(XFillBmpPosItem(RP_LM)); break;
                    case GPOS_MM: rToSet.Put(XFillBmpPosItem(RP_MM)); break;
                    case GPOS_RM: rToSet.Put(XFillBmpPosItem(RP_RM)); break;
                    case GPOS_LB: rToSet.Put(XFillBmpPosItem(RP_LB)); break;
                    case GPOS_MB: rToSet.Put(XFillBmpPosItem(RP_MB)); break;
                    case GPOS_RB: rToSet.Put(XFillBmpPosItem(RP_RB)); break;
                    default: break; // already handled GPOS_AREA, GPOS_TILED and GPOS_NONE
                }
            }

            // check for transparency
            const sal_Int8 nTransparency(rBrush.getGraphicTransparency());

            if(0 != nTransparency)
            {
                // nTransparency is in range [0..100]
                rToSet.Put(XFillTransparenceItem(nTransparency));
            }
        }
        else
        {
            OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)");
        }
    }
    else
    {
        // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(),
        // still need to rescue the color used. There are sequences used on the UNO API at
        // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B,
        // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY)
        // to zero later. When not saving the color, it will be lost
        const Color aColor(rBrush.GetColor().GetRGBColor());

        // rToSet.Put(XFillStyleItem(XFILL_NONE));
        rToSet.Put(XFillColorItem(String(), aColor));
    }
}

//UUUU
sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents)
{
    sal_uInt16 nFillTransparence(static_cast< const XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, bSearchInParents)).GetValue());
    const SfxPoolItem* pGradientItem = 0;

    if(SFX_ITEM_SET == rSourceSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents, &pGradientItem)
        && static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->IsEnabled())
    {
        const XGradient& rGradient = static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->GetGradientValue();
        const sal_uInt16 nStartLuminance(rGradient.GetStartColor().GetLuminance());
        const sal_uInt16 nEndLuminance(rGradient.GetEndColor().GetLuminance());

        // luminance is [0..255], transparence needs to be in [0..100].Maximum is 51200, thus sal_uInt16 is okay to use
        nFillTransparence = static_cast< sal_uInt16 >(((nStartLuminance + nEndLuminance) * 100) / 512);
    }

    return nFillTransparence;
}

//UUUU
SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents)
{
    Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());

    // get evtl. mixed transparence
    const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

    if(0 != nFillTransparence)
    {
        // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
        aFillColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
    }

    return SvxBrushItem(aFillColor, RES_BACKGROUND);
}

//UUUU
SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents)
{
    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));

    if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue())
    {
        // need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE)
        Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
        aFillColor.SetTransparency(0xff);

        return SvxBrushItem(aFillColor, RES_BACKGROUND);
    }

    SvxBrushItem aRetval(RES_BACKGROUND);

    switch(pXFillStyleItem->GetValue())
    {
        case XFILL_NONE:
        {
            // already handled above, can not happen again
            break;
        }
        case XFILL_SOLID:
        {
            // create SvxBrushItem with fill color
            aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents);
            break;
        }
        case XFILL_GRADIENT:
        {
            // cannot be directly supported, but do the best possible
            const XGradient aXGradient(static_cast< const XFillGradientItem& >(rSourceSet.Get(XATTR_FILLGRADIENT)).GetGradientValue());
            const basegfx::BColor aStartColor(aXGradient.GetStartColor().getBColor() * (aXGradient.GetStartIntens() * 0.01));
            const basegfx::BColor aEndColor(aXGradient.GetEndColor().getBColor() * (aXGradient.GetEndIntens() * 0.01));

            // use half/half mixed color from gradient start and end
            Color aMixedColor((aStartColor + aEndColor) * 0.5);

            // get evtl. mixed transparence
            const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

            if(0 != nFillTransparence)
            {
                // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
                aMixedColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));
            }

            aRetval = SvxBrushItem(aMixedColor, RES_BACKGROUND);
            break;
        }
        case XFILL_HATCH:
        {
            // cannot be directly supported, but do the best possible
            const XHatch& rHatch(static_cast< const XFillHatchItem& >(rSourceSet.Get(XATTR_FILLHATCH)).GetHatchValue());
            const bool bFillBackground(static_cast< const XFillBackgroundItem& >(rSourceSet.Get(XATTR_FILLBACKGROUND)).GetValue());

            if(bFillBackground)
            {
                // hatch is background-filled, use FillColor as if XFILL_SOLID
                aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents);
            }
            else
            {
                // hatch is not background-filled and using hatch color would be too dark; compensate
                // somewhat by making it more transparent
                Color aHatchColor(rHatch.GetColor());

                // get evtl. mixed transparence
                sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

                // take half orig transparence, add half transparent, clamp result
                nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255);

                // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned
                aHatchColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100));

                aRetval = SvxBrushItem(aHatchColor, RES_BACKGROUND);
            }

            break;
        }
        case XFILL_BITMAP:
        {
            // create SvxBrushItem with bitmap info and flags
            const XFillBitmapItem& rBmpItm = static_cast< const XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP, bSearchInParents));
            const Graphic aGraphic(rBmpItm.GetGraphicObject().GetGraphic());

            if(GRAPHIC_NONE != aGraphic.GetType())
            {
                // get graphic position
                SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE);
                const XFillBmpStretchItem& rStretchItem = static_cast< const XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents));
                const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents));

                if(rTileItem.GetValue())
                {
                    aSvxGraphicPosition = GPOS_TILED;
                }
                else if(rStretchItem.GetValue())
                {
                    aSvxGraphicPosition = GPOS_AREA;
                }
                else
                {
                    const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents));

                    switch(rPosItem.GetValue())
                    {
                        case RP_LT: aSvxGraphicPosition = GPOS_LT; break;
                        case RP_MT: aSvxGraphicPosition = GPOS_MT; break;
                        case RP_RT: aSvxGraphicPosition = GPOS_RT; break;
                        case RP_LM: aSvxGraphicPosition = GPOS_LM; break;
                        case RP_MM: aSvxGraphicPosition = GPOS_MM; break;
                        case RP_RM: aSvxGraphicPosition = GPOS_RM; break;
                        case RP_LB: aSvxGraphicPosition = GPOS_LB; break;
                        case RP_MB: aSvxGraphicPosition = GPOS_MB; break;
                        case RP_RB: aSvxGraphicPosition = GPOS_RB; break;
                    }
                }

                // create with given graphic and position
                aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, RES_BACKGROUND);

                // get evtl. mixed transparence
                const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));

                if(0 != nFillTransparence)
                {
                    // nFillTransparence is in range [0..100] and needs to be in [0..100] signed
                    aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence));
                }
            }

            break;
        }
    }

    return aRetval;
}

//eof
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 741627a..a3b5489 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -36,10 +36,8 @@
#include <svx/xflhtit.hxx>
#include <svx/xfltrit.hxx>
#include <editeng/memberids.hrc>

#include <swtypes.hxx>
#include <cmdid.h>

#include <memory>
#include <hints.hxx>
#include <doc.hxx>
@@ -105,10 +103,8 @@
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/printer.hxx>
//Begin Bug 119922
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
//End Bug 119922
#include <SwStyleNameMapper.hxx>
#include <xmloff/xmlcnitm.hxx>
#include <poolfmt.hxx>
@@ -122,7 +118,7 @@
#include <switerator.hxx>

//UUUU
#include <unobrushitemhelper.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xgrscit.hxx>
@@ -138,6 +134,7 @@
#include <svx/xflboxy.hxx>
#include <svx/xflbckit.hxx>
#include <svx/unoshape.hxx>
#include <swunohelper.hxx>

// from fefly1.cxx
extern sal_Bool lcl_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
@@ -152,9 +149,6 @@ using ::com::sun::star::style::XStyleFamiliesSupplier;
const sal_Char __FAR_DATA sPackageProtocol[] = "vnd.sun.star.Package:";
const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";

//UUUU
#define OWN_ATTR_FILLBMP_MODE   (OWN_ATTR_VALUE_START+45)

/****************************************************************************
    Rahmenbeschreibung
****************************************************************************/
@@ -203,6 +197,13 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet,
                                                      const sal_Bool bOasis /*sal_False*/ )
//End Bug 119922
{
    //UUUU assert when the target SfxItemSet has no parent. It *should* have the pDfltFrmFmt
    // from SwDoc set as parent (or similar) to have the necessary XFILL_NONE in the ItemSet
    if(!rToSet.GetParent())
    {
        OSL_ENSURE(false, "OOps, target SfxItemSet *should* have a parent which contains XFILL_NONE as XFillStyleItem (!)");
    }

    sal_Bool bRet = sal_True;
    //Anker kommt auf jeden Fall in den Set
    SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
@@ -297,7 +298,10 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet,
    // in the obvious order some attributes may be wrong since they are set by the 1st set, but not
    // redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If
    // it is necessary for any reason to set both (it should not) a in-between step will be needed
    // that resets the items for FillAttributes in rToSet to default
    // that resets the items for FillAttributes in rToSet to default.
    // Note: There are other mechanisms in XMLOFF to pre-sort this relationship already, but this version
    // was used initially, is tested and works. Keep it to be able to react when another feed adds attributes
    // from both sets.
    if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed)
    {
        //UUUU create a temporary SvxBrushItem, fill the attributes to it and use it to set
@@ -1729,7 +1733,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
            if(RES_BACKGROUND == pEntry->nWID)
            {
                const SwAttrSet& rSet = pFmt->GetAttrSet();
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
                SvxBrushItem aChangedBrushItem(aOriginalBrushItem);

                aChangedBrushItem.PutValue(aValue, nMemberId);
@@ -2218,7 +2222,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
            if(RES_BACKGROUND == pEntry->nWID)
            {
                //UUUU
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));

                if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
                {
@@ -2352,42 +2356,6 @@ beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
    return aStates.getConstArray()[0];
}

//UUUU
bool SwXFrame::needToMapFillItemsToSvxBrushItemTypes() const
{
    SwFrmFmt* pFmt = GetFrmFmt();

    if(!pFmt)
    {
        return false;
    }

    const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rFmtSet.GetItem(XATTR_FILLSTYLE, false)));

    if(!pXFillStyleItem)
    {
        return false;
    }

    //UUUU here different FillStyles can be excluded for export; it will depend on the
    // quality these fallbacks can reach. That again is done in getSvxBrushItemFromSourceSet,
    // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem.
    // For now, take them all - except XFILL_NONE

    if(XFILL_NONE != pXFillStyleItem->GetValue())
    {
        return true;
    }

    //if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue())
    //{
    //    return true;
    //}

    return false;
}

uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
    const uno::Sequence< OUString >& aPropertyNames )
        throw(beans::UnknownPropertyException, uno::RuntimeException)
@@ -2433,7 +2401,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
            // as beans::PropertyState_DIRECT_VALUE to let users of this property call
            // getPropertyValue where the member properties will be mapped from the
            // fill attributes to the according SvxBrushItem entries
            else if(RES_BACKGROUND == pEntry->nWID && needToMapFillItemsToSvxBrushItemTypes())
            else if(RES_BACKGROUND == pEntry->nWID && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(rFmtSet))
            {
                pStates[i] = beans::PropertyState_DIRECT_VALUE;
            }
@@ -2743,6 +2711,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
        SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );

        SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );

        //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
        aFrmSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet());

        //jetzt muessen die passenden Items in den Set
        sal_Bool bSizeFound;
        if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 72853d5..1d2c108 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -585,6 +585,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                    COMMON_TEXT_CONTENT_PROPERTIES
                    { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT,     CPPU_E2T(CPPUTYPE_OUSTRING),         PropertyAttribute::MAYBEVOID,     0},\
                    { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE,  CPPU_E2T(CPPUTYPE_OUSTRINGS),     PropertyAttribute::MAYBEVOID,     0},\

                    //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
                    // but need own defines in Writer due to later association of strings
                    // and uno types (see loop at end of this method and definition of SW_PROP_NMID)
                    // This entry is for adding that properties to style import/export
                    //UUUU Added for paragraph backgrounds, this is for paragraph itself
                    FILL_PROPERTIES_SW

                    {0,0,0,0,0,0}
                };
                aMapEntriesArr[nPropertyId] = aParagraphMap_Impl;
@@ -612,6 +620,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                    TABSTOPS_MAP_ENTRY
                    COMMON_TEXT_CONTENT_PROPERTIES
                    { SW_PROP_NMID(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE,     CPPU_E2T(CPPUTYPE_OUSTRING),         PropertyAttribute::MAYBEVOID,     0},

                    //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
                    // but need own defines in Writer due to later association of strings
                    // and uno types (see loop at end of this method and definition of SW_PROP_NMID)
                    // This entry is for adding that properties to style import/export
                    //UUUU Added for paragraph backgrounds, this is for Paragraph AutoStyles
                    FILL_PROPERTIES_SW

                    {0,0,0,0,0,0}
                };
                aMapEntriesArr[nPropertyId] = aAutoParaStyleMap;
@@ -727,6 +743,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                static SfxItemPropertyMapEntry aParaStyleMap [] =
                {
                    COMMON_PARA_STYLE_PROPERTIES

                    //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
                    // but need own defines in Writer due to later association of strings
                    // and uno types (see loop at end of this method and definition of SW_PROP_NMID)
                    // This entry is for adding that properties to style import/export
                    //UUUU Added for paragraph backgrounds, this is for Paragraph Styles
                    FILL_PROPERTIES_SW

                    {0,0,0,0,0,0}
                };
                aMapEntriesArr[nPropertyId] = aParaStyleMap;
@@ -738,6 +762,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                {
                    COMMON_PARA_STYLE_PROPERTIES
                    { SW_PROP_NMID(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, CPPU_E2T(CPPUTYPE_SEQNAMEDVALUE), PropertyAttribute::MAYBEVOID, 0},

                    //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
                    // but need own defines in Writer due to later association of strings
                    // and uno types (see loop at end of this method and definition of SW_PROP_NMID)
                    // This entry is for adding that properties to style import/export
                    //UUUU Added for paragraph backgrounds, this is for Paragraph Styles
                    FILL_PROPERTIES_SW

                    {0,0,0,0,0,0}
                };
                aMapEntriesArr[nPropertyId] = aParaStyleMap;
@@ -855,56 +887,59 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                    { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX,               CPPU_E2T(CPPUTYPE_INT32),   0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW,             CPPU_E2T(CPPUTYPE_SHADOWFMT),   PROPERTY_NONE, CONVERT_TWIPS},

                    { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND,   CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_BACK_COLOR        },
                //  { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND,  &,                              PROPERTY_NONE, MID_GRAPHIC
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND,          CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL    },
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND,           CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER    },
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND,     CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE,    CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE,   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND,     CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT       },
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX,             CPPU_E2T(CPPUTYPE_BORDERLINE),  0, LEFT_BORDER  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX,                CPPU_E2T(CPPUTYPE_BORDERLINE),  0, RIGHT_BORDER |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX,              CPPU_E2T(CPPUTYPE_BORDERLINE),  0, TOP_BORDER   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX,               CPPU_E2T(CPPUTYPE_BORDERLINE),  0, BOTTOM_BORDER|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX,    CPPU_E2T(CPPUTYPE_INT32),    PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX,                CPPU_E2T(CPPUTYPE_INT32),   0, LEFT_BORDER_DISTANCE  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX,               CPPU_E2T(CPPUTYPE_INT32),   0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX,             CPPU_E2T(CPPUTYPE_INT32),   0, TOP_BORDER_DISTANCE   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX,              CPPU_E2T(CPPUTYPE_INT32),   0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW,        CPPU_E2T(CPPUTYPE_SHADOWFMT),   PROPERTY_NONE, CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32),            PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS       },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN),            PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN),          PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT,       CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON,            CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING,            CPPU_E2T(CPPUTYPE_BOOLEAN),         PropertyAttribute::MAYBEVOID ,0         },
                    //UUU use real WhichIDs for Header, no longer use extra-defined WhichIDs which make handling harder as needed.
                    // The implementation will decide if these are part of Header/Footer or PageStyle depending on the SlotName,
                    // more precisely on the first characters. Thus it is necessary that these are 'Header' for the Header slots
                    { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR),             RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_BACK_COLOR        },
                //  { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC),                RES_BACKGROUND,     &,                              PROPERTY_NONE, MID_GRAPHIC
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL),            RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL    },
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER),         RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER    },
                    { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION),       RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN),            RES_LR_SPACE,                   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN),           RES_LR_SPACE,                   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT),       RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT       },
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER),            RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, LEFT_BORDER  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER),           RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, RIGHT_BORDER |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER),             RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, TOP_BORDER   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER),          RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, BOTTOM_BORDER|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE),        RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),    PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE),   RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, LEFT_BORDER_DISTANCE  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE),  RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE),    RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, TOP_BORDER_DISTANCE   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT),          RES_SHADOW,                     CPPU_E2T(CPPUTYPE_SHADOWFMT),   PROPERTY_NONE, CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE),          RES_UL_SPACE,                   CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS       },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT),      SID_ATTR_PAGE_DYNAMIC,          CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED),              SID_ATTR_PAGE_SHARED,           CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT),                 SID_ATTR_PAGE_SIZE,             CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON),                  SID_ATTR_PAGE_ON,               CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING),        RES_HEADER_FOOTER_EAT_SPACING,  CPPU_E2T(CPPUTYPE_BOOLEAN),         PropertyAttribute::MAYBEVOID ,0         },

                    { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND,   CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_BACK_COLOR        },
                //  { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND,      &,                              PROPERTY_NONE, MID_GRAPHIC
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND,      CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL    },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND,       CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER    },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND,     CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE,    CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE,   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND,     CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT       },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX,             CPPU_E2T(CPPUTYPE_BORDERLINE),  0, LEFT_BORDER  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX,                CPPU_E2T(CPPUTYPE_BORDERLINE),  0, RIGHT_BORDER |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX,              CPPU_E2T(CPPUTYPE_BORDERLINE),  0, TOP_BORDER   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX,               CPPU_E2T(CPPUTYPE_BORDERLINE),  0, BOTTOM_BORDER|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX,    CPPU_E2T(CPPUTYPE_INT32),    PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX,                CPPU_E2T(CPPUTYPE_INT32),   0, LEFT_BORDER_DISTANCE  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX,               CPPU_E2T(CPPUTYPE_INT32),   0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX,             CPPU_E2T(CPPUTYPE_INT32),   0, TOP_BORDER_DISTANCE   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX,              CPPU_E2T(CPPUTYPE_INT32),   0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW,        CPPU_E2T(CPPUTYPE_SHADOWFMT),   PROPERTY_NONE, CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32),            PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS       },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN),            PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN),          PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT,       CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON,            CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING,            CPPU_E2T(CPPUTYPE_BOOLEAN),         PropertyAttribute::MAYBEVOID ,0         },

                    //UUU use real WhichIDs for Footer, see Header (above) for more infos
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR),             RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_BACK_COLOR        },
                //  { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC),                RES_BACKGROUND,     &,                              PROPERTY_NONE, MID_GRAPHIC
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL),            RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL    },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER),         RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER    },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION),       RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN),            RES_LR_SPACE,                   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN),           RES_LR_SPACE,                   CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT),       RES_BACKGROUND,                 CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT       },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER),            RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, LEFT_BORDER  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER),           RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, RIGHT_BORDER |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER),             RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, TOP_BORDER   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER),          RES_BOX,                        CPPU_E2T(CPPUTYPE_BORDERLINE),  0, BOTTOM_BORDER|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE),        RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),    PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE),   RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, LEFT_BORDER_DISTANCE  |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE),  RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE),    RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, TOP_BORDER_DISTANCE   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), RES_BOX,                        CPPU_E2T(CPPUTYPE_INT32),   0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT),          RES_SHADOW,                     CPPU_E2T(CPPUTYPE_SHADOWFMT),   PROPERTY_NONE, CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE),          RES_UL_SPACE,                   CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS       },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT),      SID_ATTR_PAGE_DYNAMIC,          CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED),              SID_ATTR_PAGE_SHARED,           CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT),                 SID_ATTR_PAGE_SIZE,             CPPU_E2T(CPPUTYPE_INT32),           PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON),                  SID_ATTR_PAGE_ON,               CPPU_E2T(CPPUTYPE_BOOLEAN),         PROPERTY_NONE ,0         },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING),        RES_HEADER_FOOTER_EAT_SPACING,  CPPU_E2T(CPPUTYPE_BOOLEAN),         PropertyAttribute::MAYBEVOID ,0         },

                    { SW_PROP_NMID(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE,           CPPU_E2T(CPPUTYPE_BOOLEAN),             PROPERTY_NONE ,MID_PAGE_ORIENTATION   },
                    { SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE,             CPPU_E2T(CPPUTYPE_INT16),           PROPERTY_NONE , MID_PAGE_NUMTYPE       },
@@ -936,7 +971,8 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                    { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO,        CPPU_E2T(CPPUTYPE_INT32),   PROPERTY_NONE ,     MID_LINE_TEXT_DIST   |CONVERT_TWIPS },
                    { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO,         CPPU_E2T(CPPUTYPE_INT32),   PROPERTY_NONE ,     MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
                        // writing grid

                    // writing grid
                    { SW_PROP_NMID(UNO_NAME_GRID_COLOR), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_COLOR},
                    { SW_PROP_NMID(UNO_NAME_GRID_LINES), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_LINES},
                    { SW_PROP_NMID(UNO_NAME_GRID_BASE_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEHEIGHT|CONVERT_TWIPS},
@@ -948,6 +984,72 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                    { SW_PROP_NMID(UNO_NAME_GRID_BASE_WIDTH), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEWIDTH|CONVERT_TWIPS},
                    { SW_PROP_NMID(UNO_NAME_GRID_SNAP_TO_CHARS), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_SNAPTOCHARS},
                    { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE},

                    //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx
                    // but need own defines in Writer due to later association of strings
                    // and uno types (see loop at end of this method and definition of SW_PROP_NMID)
                    // This entry is for adding that properties to style import/export
                    FILL_PROPERTIES_SW

                    //UUUU Added DrawingLayer FillStyle Properties for Header. These need an own unique name,
                    // but reuse the same WhichIDs as the regular fill. The implementation will decide to which
                    // group of fill properties it belongs based on the start of the name (was already done in
                    // the implementation partially), thus all SlotNames *have* to start with 'Header'
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE),           XATTR_FILLBMP_SIZELOG,          CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_OFFSET_X),               XATTR_FILLBMP_TILEOFFSETX,      CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_OFFSET_Y),               XATTR_FILLBMP_TILEOFFSETY,      CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X),      XATTR_FILLBMP_POSOFFSETX,       CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y),      XATTR_FILLBMP_POSOFFSETY,       CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT),        XATTR_FILLBMP_POS,              CPPU_E2T(CPPUTYPE_RECTANGLEPOINT) , 0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_SIZE_X),                 XATTR_FILLBMP_SIZEX,            CPPU_E2T(CPPUTYPE_INT32) ,          0,  SFX_METRIC_ITEM},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_SIZE_Y),                 XATTR_FILLBMP_SIZEY,            CPPU_E2T(CPPUTYPE_INT32) ,          0,  SFX_METRIC_ITEM},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_STRETCH),                XATTR_FILLBMP_STRETCH,          CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_TILE),                   XATTR_FILLBMP_TILE,             CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_MODE),                   OWN_ATTR_FILLBMP_MODE,          CPPU_E2T(CPPUTYPE_BITMAPMODE),      0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLCOLOR),                      XATTR_FILLCOLOR,                CPPU_E2T(CPPUTYPE_INT32),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBACKGROUND),                 XATTR_FILLBACKGROUND,           CPPU_E2T(CPPUTYPE_BOOLEAN),         0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAP),                     XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_REFBITMAP),       0,  MID_BITMAP},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAPNAME),                 XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAPURL),                  XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_GRAFURL },
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT),          XATTR_GRADIENTSTEPCOUNT,        CPPU_E2T(CPPUTYPE_INT16),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENT),                   XATTR_FILLGRADIENT,             CPPU_E2T(CPPUTYPE_GRADIENT),        0,  MID_FILLGRADIENT},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENTNAME),               XATTR_FILLGRADIENT,             CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLHATCH),                      XATTR_FILLHATCH,                CPPU_E2T(CPPUTYPE_HATCH),           0,  MID_FILLHATCH},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLHATCHNAME),                  XATTR_FILLHATCH,                CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLSTYLE),                      XATTR_FILLSTYLE,                CPPU_E2T(CPPUTYPE_FILLSTYLE),       0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILL_TRANSPARENCE),              XATTR_FILLTRANSPARENCE,         CPPU_E2T(CPPUTYPE_INT16),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT),       XATTR_FILLFLOATTRANSPARENCE,    CPPU_E2T(CPPUTYPE_GRADIENT),        0,  MID_FILLGRADIENT},
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME),   XATTR_FILLFLOATTRANSPARENCE,    CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_HEADER_FILLCOLOR_2),                    XATTR_SECONDARYFILLCOLOR,       CPPU_E2T(CPPUTYPE_INT32),           0,  0},

                    //UUUU Added DrawingLayer FillStyle Properties for Footer, similar as for Header (see there)
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE),           XATTR_FILLBMP_SIZELOG,          CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_OFFSET_X),               XATTR_FILLBMP_TILEOFFSETX,      CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_OFFSET_Y),               XATTR_FILLBMP_TILEOFFSETY,      CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X),      XATTR_FILLBMP_POSOFFSETX,       CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y),      XATTR_FILLBMP_POSOFFSETY,       CPPU_E2T(CPPUTYPE_INT32) ,          0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT),        XATTR_FILLBMP_POS,              CPPU_E2T(CPPUTYPE_RECTANGLEPOINT) , 0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_SIZE_X),                 XATTR_FILLBMP_SIZEX,            CPPU_E2T(CPPUTYPE_INT32) ,          0,  SFX_METRIC_ITEM},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_SIZE_Y),                 XATTR_FILLBMP_SIZEY,            CPPU_E2T(CPPUTYPE_INT32) ,          0,  SFX_METRIC_ITEM},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_STRETCH),                XATTR_FILLBMP_STRETCH,          CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_TILE),                   XATTR_FILLBMP_TILE,             CPPU_E2T(CPPUTYPE_BOOLEAN) ,        0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_MODE),                   OWN_ATTR_FILLBMP_MODE,          CPPU_E2T(CPPUTYPE_BITMAPMODE),      0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLCOLOR),                      XATTR_FILLCOLOR,                CPPU_E2T(CPPUTYPE_INT32),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBACKGROUND),                 XATTR_FILLBACKGROUND,           CPPU_E2T(CPPUTYPE_BOOLEAN),         0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAP),                     XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_REFBITMAP),       0,  MID_BITMAP},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAPNAME),                 XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAPURL),                  XATTR_FILLBITMAP,               CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_GRAFURL },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT),          XATTR_GRADIENTSTEPCOUNT,        CPPU_E2T(CPPUTYPE_INT16),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENT),                   XATTR_FILLGRADIENT,             CPPU_E2T(CPPUTYPE_GRADIENT),        0,  MID_FILLGRADIENT},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENTNAME),               XATTR_FILLGRADIENT,             CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLHATCH),                      XATTR_FILLHATCH,                CPPU_E2T(CPPUTYPE_HATCH),           0,  MID_FILLHATCH},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLHATCHNAME),                  XATTR_FILLHATCH,                CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLSTYLE),                      XATTR_FILLSTYLE,                CPPU_E2T(CPPUTYPE_FILLSTYLE),       0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILL_TRANSPARENCE),              XATTR_FILLTRANSPARENCE,         CPPU_E2T(CPPUTYPE_INT16),           0,  0},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT),       XATTR_FILLFLOATTRANSPARENCE,    CPPU_E2T(CPPUTYPE_GRADIENT),        0,  MID_FILLGRADIENT},
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME),   XATTR_FILLFLOATTRANSPARENCE,    CPPU_E2T(CPPUTYPE_OUSTRING),        0,  MID_NAME },
                    { SW_PROP_NMID(UNO_NAME_FOOTER_FILLCOLOR_2),                    XATTR_SECONDARYFILLCOLOR,       CPPU_E2T(CPPUTYPE_INT32),           0,  0},

                    {0,0,0,0,0,0}
                };
                aMapEntriesArr[nPropertyId] = aPageStyleMap;
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index c7968ce..9df686a 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

@@ -52,11 +50,17 @@
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>

//UUUU
#include <swunohelper.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <editeng/unoipset.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflbmtit.hxx>
#include <com/sun/star/drawing/BitmapMode.hpp>

using namespace ::com::sun::star;
using ::rtl::OUString;


/* -----------------------------01.12.00 18:09--------------------------------

 ---------------------------------------------------------------------------*/
@@ -174,6 +178,13 @@ public:
        throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                uno::RuntimeException);

    //UUUU
    void GetSinglePropertyValue_Impl(
        const SfxItemPropertySimpleEntry& rEntry,
        const SfxItemSet& rSet,
        uno::Any& rAny ) const
    throw(uno::RuntimeException);

    uno::Sequence< beans::GetDirectPropertyTolerantResult >
        GetPropertyValuesTolerant_Impl(
            const uno::Sequence< ::rtl::OUString >& rPropertyNames,
@@ -481,6 +492,99 @@ throw (beans::PropertyVetoException, lang::IllegalArgumentException,
/* -----------------------------02.04.01 11:43--------------------------------

 ---------------------------------------------------------------------------*/

//UUUU Support for DrawingLayer FillStyles for GetPropertyValue() usages
void SwXParagraph::Impl::GetSinglePropertyValue_Impl(
    const SfxItemPropertySimpleEntry& rEntry,
    const SfxItemSet& rSet,
    uno::Any& rAny ) const
throw(uno::RuntimeException)
{
    bool bDone(false);

    switch(rEntry.nWID)
    {
        case RES_BACKGROUND:
        {
            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
            const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM));

            if(!aOriginalBrushItem.QueryValue(rAny, nMemberId))
            {
                OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
            }

            bDone = true;
            break;
        }
        case OWN_ATTR_FILLBMP_MODE:
        {
            const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
            const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));

            if( pTileItem && pTileItem->GetValue() )
            {
                rAny <<= drawing::BitmapMode_REPEAT;
            }
            else if( pStretchItem && pStretchItem->GetValue() )
            {
                rAny <<= drawing::BitmapMode_STRETCH;
            }
            else
            {
                rAny <<= drawing::BitmapMode_NO_REPEAT;
            }

            bDone = true;
            break;
        }
        default: break;
    }

    if(!bDone)
    {
        // fallback to standard get value implementation used before this helper was created
        m_rPropSet.getPropertyValue(rEntry, rSet, rAny);

        if(rEntry.pType && *(rEntry.pType) == ::getCppuType((const sal_Int16*)0) && *(rEntry.pType) != rAny.getValueType())
        {
            // since the sfx uInt16 item now exports a sal_Int32, we may have to fix this here
            sal_Int32 nValue(0);

            rAny >>= nValue;
            rAny <<= static_cast< sal_Int16 >(nValue);
        }

        //UUUU check for needed metric translation
        if(rEntry.nMemberId & SFX_METRIC_ITEM)
        {
            bool bDoIt(true);

            if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
            {
                // exception: If these ItemTypes are used, do not convert when these are negative
                // since this means they are intended as percent values
                sal_Int32 nValue = 0;

                if(rAny >>= nValue)
                {
                    bDoIt = nValue > 0;
                }
            }

            if(bDoIt)
            {
                const SfxMapUnit eMapUnit(rSet.GetPool()->GetMetric(rEntry.nWID));

                if(eMapUnit != SFX_MAPUNIT_100TH_MM)
                {
                    SvxUnoConvertToMM(eMapUnit, rAny);
                }
            }
        }
    }
}

uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl(
        const uno::Sequence< OUString > & rPropertyNames )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
@@ -514,8 +618,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                *pEntry, aPam, &(pValues[nProp]), eTemp, &rTxtNode );
            if (!bDone)
            {
                m_rPropSet.getPropertyValue(
                    *pEntry, rAttrSet, pValues[nProp]);
                //UUUU
                GetSinglePropertyValue_Impl(*pEntry, rAttrSet, pValues[nProp]);
            }
        }
    }
@@ -797,8 +901,8 @@ throw (uno::RuntimeException)
                        // if not found try the real paragraph attributes...
                        if (!bDone)
                        {
                            m_rPropSet.getPropertyValue(
                                *pEntry, rValueAttrSet, aValue );
                            //UUUU
                            GetSinglePropertyValue_Impl(*pEntry, rValueAttrSet, aValue);
                        }
                    }

@@ -931,61 +1035,107 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,

//-----------------------------------------------------------------------------
beans::PropertyState lcl_SwXParagraph_getPropertyState(
//                          SwUnoCrsr& rUnoCrsr,
                            const SwTxtNode& rTxtNode,
                            const SwAttrSet** ppSet,
                            const SfxItemPropertySimpleEntry& rEntry,
                            sal_Bool &rAttrSetFetched )
throw (beans::UnknownPropertyException)
    // SwUnoCrsr& rUnoCrsr,
    const SwTxtNode& rTxtNode,
    const SwAttrSet** ppSet,
    const SfxItemPropertySimpleEntry& rEntry,
    sal_Bool &rAttrSetFetched)
    throw (beans::UnknownPropertyException)
{
    beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
    beans::PropertyState eRet(beans::PropertyState_DEFAULT_VALUE);

    if(!(*ppSet) && !rAttrSetFetched )
    if(!(*ppSet) && !rAttrSetFetched)
    {
        (*ppSet) = rTxtNode.GetpSwAttrSet();
        rAttrSetFetched = sal_True;
    }
    SwPosition aPos( rTxtNode );
    SwPaM aPam( aPos );
    switch( rEntry.nWID )

    SwPosition aPos(rTxtNode);
    SwPaM aPam(aPos);
    bool bDone(false);

    switch(rEntry.nWID)
    {
    case FN_UNO_NUM_RULES:
        // if numbering is set, return it; else do nothing
        SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL );
        break;
    case FN_UNO_ANCHOR_TYPES:
        break;
    case RES_ANCHOR:
        if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId )
            goto lcl_SwXParagraph_getPropertyStateDEFAULT;
        break;
    case RES_SURROUND:
        if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId )
            goto lcl_SwXParagraph_getPropertyStateDEFAULT;
        break;
    case FN_UNO_PARA_STYLE:
    case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
        case FN_UNO_NUM_RULES:
        {
            SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(
                aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
            eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
                        : beans::PropertyState_AMBIGUOUS_VALUE;
            // if numbering is set, return it; else do nothing
            SwUnoCursorHelper::getNumberingProperty(aPam,eRet,NULL);
            bDone = true;
            break;
        }
        break;
    case FN_UNO_PAGE_STYLE:
        case FN_UNO_ANCHOR_TYPES:
        {
            bDone = true;
            break;
        }
        case RES_ANCHOR:
        {
            bDone = (MID_SURROUND_SURROUNDTYPE == rEntry.nMemberId);
            break;
        }
        case RES_SURROUND:
        {
            bDone = (MID_ANCHOR_ANCHORTYPE == rEntry.nMemberId);
            break;
        }
        case FN_UNO_PARA_STYLE:
        case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
        {
            SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(aPam,rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
            eRet = pFmt ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE;
            bDone = true;
            break;
        }
        case FN_UNO_PAGE_STYLE:
        {
            String sVal;
            SwUnoCursorHelper::GetCurPageStyle( aPam, sVal );
            eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE
                              : beans::PropertyState_AMBIGUOUS_VALUE;
            SwUnoCursorHelper::GetCurPageStyle(aPam,sVal);
            eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE;
            bDone = true;
            break;
        }
        break;
    lcl_SwXParagraph_getPropertyStateDEFAULT:
    default:
        if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, sal_False))
            eRet = beans::PropertyState_DIRECT_VALUE;
        break;

        //UUUU DrawingLayer PropertyStyle support
        case OWN_ATTR_FILLBMP_MODE:
        {
            if(*ppSet)
            {
                if(SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_STRETCH, false)
                    || SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_TILE, false))
                {
                    eRet = beans::PropertyState_DIRECT_VALUE;
                }
                else
                {
                    eRet = beans::PropertyState_AMBIGUOUS_VALUE;
                }

                bDone = true;
            }
            break;
        }
        case RES_BACKGROUND:
        {
            if(*ppSet)
            {
                if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(**ppSet))
                {
                    eRet = beans::PropertyState_DIRECT_VALUE;
                    bDone = true;
                }
            }
            break;
        }
    }

    if(!bDone)
    {
        if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID,sal_False))
        {
            eRet = beans::PropertyState_DIRECT_VALUE;
        }
    }

    return eRet;
}

@@ -1102,10 +1252,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
            static_cast<cppu::OWeakObject *>(this));
    }

    if (pEntry->nWID < RES_FRMATR_END)
    const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END);
    const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID);

    if(bBelowFrmAtrEnd || bDrawingLayerRange)
    {
        SvUShortsSort aWhichIds;
        aWhichIds.Insert(pEntry->nWID);

        //UUUU For FillBitmapMode two IDs have to be reset (!)
        if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
        {
            aWhichIds.Insert(XATTR_FILLBMP_STRETCH);
            aWhichIds.Insert(XATTR_FILLBMP_TILE);
        }
        else
        {
            aWhichIds.Insert(pEntry->nWID);
        }

        if (pEntry->nWID < RES_PARATR_BEGIN)
        {
            aCursor.GetDoc()->ResetAttrs(aCursor, sal_True, &aWhichIds);
@@ -1116,20 +1280,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
            // to paragraph boundaries
            SwPosition aStart( *aCursor.Start() );
            SwPosition aEnd  ( *aCursor.End()   );
            ::std::auto_ptr<SwUnoCrsr> pTemp(
                aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) );
            ::std::auto_ptr<SwUnoCrsr> pTemp( aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) );

            if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
            {
                pTemp->MovePara(fnParaCurr, fnParaStart);
            }

            pTemp->SetMark();
            *pTemp->GetPoint() = aEnd;
            //pTemp->Exchange();

            SwUnoCursorHelper::SelectPam(*pTemp, true);

            if (!SwUnoCursorHelper::IsEndOfPara(*pTemp))
            {
                pTemp->MovePara(fnParaCurr, fnParaEnd);
            }

            pTemp->GetDoc()->ResetAttrs(*pTemp, sal_True, &aWhichIds);
        }
    }
@@ -1167,10 +1335,13 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
            static_cast<cppu::OWeakObject *>(this));
    }

    if (pEntry->nWID < RES_FRMATR_END)
    const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END);
    const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID);

    if(bBelowFrmAtrEnd || bDrawingLayerRange)
    {
        const SfxPoolItem& rDefItem =
            rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
        const SfxPoolItem& rDefItem = rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);

        rDefItem.QueryValue(aRet, pEntry->nMemberId);
    }

diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index c74c0ba..0249810 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -781,32 +781,87 @@ const SwPropNameTab aPropNameTab = {
/* 0743 UNO_NAME_INITIALS */            {MAP_CHAR_LEN("Initials")},

//UUUU names for FillAttributes from SVX; use already existing string defines from editengine
/* 0744 UNO_NAME_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_LOGICAL_SIZE)},
/* 0745 UNO_NAME_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_X)},
/* 0746 UNO_NAME_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_Y)},
/* 0747 UNO_NAME_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_X)},
/* 0748 UNO_NAME_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_Y)},
/* 0749 UNO_NAME_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_RECTANGLE_POINT)},
/* 0750 UNO_NAME_FILLBMP_SIZE_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_X)},
/* 0751 UNO_NAME_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_Y)},
/* 0752 UNO_NAME_FILLBMP_STRETCH */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_STRETCH)},
/* 0753 UNO_NAME_FILLBMP_TILE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_TILE)},
/* 0754 UNO_NAME_FILLBMP_MODE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_MODE)},
/* 0755 UNO_NAME_FILLCOLOR */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR)},
/* 0756 UNO_NAME_FILLBACKGROUND */ {MAP_CHAR_LEN(UNO_NAME_FILLBACKGROUND)},
/* 0757 UNO_NAME_FILLBITMAP */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAP)},
/* 0758 UNO_NAME_FILLBITMAPNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPNAME)},
/* 0759 UNO_NAME_FILLBITMAPURL */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPURL)},
/* 0760 UNO_NAME_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTSTEPCOUNT)},
/* 0761 UNO_NAME_FILLGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENT)},
/* 0762 UNO_NAME_FILLGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTNAME)},
/* 0763 UNO_NAME_FILLHATCH */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCH)},
/* 0764 UNO_NAME_FILLHATCHNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCHNAME)},
/* 0765 UNO_NAME_FILLSTYLE */ {MAP_CHAR_LEN(UNO_NAME_FILLSTYLE)},
/* 0766 UNO_NAME_FILL_TRANSPARENCE */ {MAP_CHAR_LEN(UNO_NAME_FILL_TRANSPARENCE)},
/* 0767 UNO_NAME_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENT)},
/* 0768 UNO_NAME_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)},
/* 0769 UNO_NAME_FILLCOLOR_2 */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR_2)}
/* 0744 UNO_NAME_SW_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_LOGICAL_SIZE)},
/* 0745 UNO_NAME_SW_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_X)},
/* 0746 UNO_NAME_SW_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_Y)},
/* 0747 UNO_NAME_SW_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_X)},
/* 0748 UNO_NAME_SW_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_Y)},
/* 0749 UNO_NAME_SW_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_RECTANGLE_POINT)},
/* 0750 UNO_NAME_SW_FILLBMP_SIZE_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_X)},
/* 0751 UNO_NAME_SW_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_Y)},
/* 0752 UNO_NAME_SW_FILLBMP_STRETCH */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_STRETCH)},
/* 0753 UNO_NAME_SW_FILLBMP_TILE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_TILE)},
/* 0754 UNO_NAME_SW_FILLBMP_MODE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_MODE)},
/* 0755 UNO_NAME_SW_FILLCOLOR */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR)},
/* 0756 UNO_NAME_SW_FILLBACKGROUND */ {MAP_CHAR_LEN(UNO_NAME_FILLBACKGROUND)},
/* 0757 UNO_NAME_SW_FILLBITMAP */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAP)},
/* 0758 UNO_NAME_SW_FILLBITMAPNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPNAME)},
/* 0759 UNO_NAME_SW_FILLBITMAPURL */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPURL)},
/* 0760 UNO_NAME_SW_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTSTEPCOUNT)},
/* 0761 UNO_NAME_SW_FILLGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENT)},
/* 0762 UNO_NAME_SW_FILLGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTNAME)},
/* 0763 UNO_NAME_SW_FILLHATCH */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCH)},
/* 0764 UNO_NAME_SW_FILLHATCHNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCHNAME)},
/* 0765 UNO_NAME_SW_FILLSTYLE */ {MAP_CHAR_LEN(UNO_NAME_FILLSTYLE)},
/* 0766 UNO_NAME_SW_FILL_TRANSPARENCE */ {MAP_CHAR_LEN(UNO_NAME_FILL_TRANSPARENCE)},
/* 0767 UNO_NAME_SW_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENT)},
/* 0768 UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)},
/* 0769 UNO_NAME_SW_FILLCOLOR_2 */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR_2)},

/* 0770 UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_LOGICAL_SIZE)},
/* 0771 UNO_NAME_HEADER_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_OFFSET_X)},
/* 0772 UNO_NAME_HEADER_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_OFFSET_Y)},
/* 0773 UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_POSITION_OFFSET_X)},
/* 0774 UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_POSITION_OFFSET_Y)},
/* 0775 UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_RECTANGLE_POINT)},
/* 0776 UNO_NAME_HEADER_FILLBMP_SIZE_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_SIZE_X)},
/* 0777 UNO_NAME_HEADER_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_SIZE_Y)},
/* 0778 UNO_NAME_HEADER_FILLBMP_STRETCH */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_STRETCH)},
/* 0779 UNO_NAME_HEADER_FILLBMP_TILE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_TILE)},
/* 0780 UNO_NAME_HEADER_FILLBMP_MODE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_MODE)},
/* 0781 UNO_NAME_HEADER_FILLCOLOR */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLCOLOR)},
/* 0782 UNO_NAME_HEADER_FILLBACKGROUND */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBACKGROUND)},
/* 0783 UNO_NAME_HEADER_FILLBITMAP */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAP)},
/* 0784 UNO_NAME_HEADER_FILLBITMAPNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAPNAME)},
/* 0785 UNO_NAME_HEADER_FILLBITMAPURL */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAPURL)},
/* 0786 UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENTSTEPCOUNT)},
/* 0787 UNO_NAME_HEADER_FILLGRADIENT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENT)},
/* 0788 UNO_NAME_HEADER_FILLGRADIENTNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENTNAME)},
/* 0789 UNO_NAME_HEADER_FILLHATCH */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLHATCH)},
/* 0790 UNO_NAME_HEADER_FILLHATCHNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLHATCHNAME)},
/* 0791 UNO_NAME_HEADER_FILLSTYLE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLSTYLE)},
/* 0792 UNO_NAME_HEADER_FILL_TRANSPARENCE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILL_TRANSPARENCE)},
/* 0793 UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLTRANSPARENCEGRADIENT)},
/* 0794 UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)},
/* 0795 UNO_NAME_HEADER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLCOLOR_2)},

/* 0776 UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_LOGICAL_SIZE)},
/* 0777 UNO_NAME_FOOTER_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_OFFSET_X)},
/* 0778 UNO_NAME_FOOTER_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_OFFSET_Y)},
/* 0779 UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_X)},
/* 0780 UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_Y)},
/* 0781 UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_RECTANGLE_POINT)},
/* 0782 UNO_NAME_FOOTER_FILLBMP_SIZE_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_SIZE_X)},
/* 0783 UNO_NAME_FOOTER_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_SIZE_Y)},
/* 0784 UNO_NAME_FOOTER_FILLBMP_STRETCH */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_STRETCH)},
/* 0785 UNO_NAME_FOOTER_FILLBMP_TILE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_TILE)},
/* 0786 UNO_NAME_FOOTER_FILLBMP_MODE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_MODE)},
/* 0787 UNO_NAME_FOOTER_FILLCOLOR */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR)},
/* 0788 UNO_NAME_FOOTER_FILLBACKGROUND */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBACKGROUND)},
/* 0789 UNO_NAME_FOOTER_FILLBITMAP */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAP)},
/* 0790 UNO_NAME_FOOTER_FILLBITMAPNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAPNAME)},
/* 0791 UNO_NAME_FOOTER_FILLBITMAPURL */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAPURL)},
/* 0792 UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENTSTEPCOUNT)},
/* 0793 UNO_NAME_FOOTER_FILLGRADIENT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENT)},
/* 0794 UNO_NAME_FOOTER_FILLGRADIENTNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENTNAME)},
/* 0795 UNO_NAME_FOOTER_FILLHATCH */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLHATCH)},
/* 0796 UNO_NAME_FOOTER_FILLHATCHNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLHATCHNAME)},
/* 0797 UNO_NAME_FOOTER_FILLSTYLE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLSTYLE)},
/* 0798 UNO_NAME_FOOTER_FILL_TRANSPARENCE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILL_TRANSPARENCE)},
/* 0799 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENT)},
/* 0800 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)},
/* 0801 UNO_NAME_FOOTER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR_2)}

};

const SwPropNameLen& SwGetPropName( sal_uInt16 nId )
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 6410f90..071f28a 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

@@ -76,12 +74,14 @@
#include <numrule.hxx>

//UUUU
#include <unobrushitemhelper.hxx>
#include <svx/unobrushitemhelper.hxx>
#include <editeng/unoipset.hxx>
#include <editeng/memberids.hrc>
#include <svx/unoshape.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflbmtit.hxx>
#include <swunohelper.hxx>
#include <svx/xbtmpit.hxx>

#include <boost/shared_ptr.hpp>

@@ -124,47 +124,6 @@ using ::rtl::OUString;
 *
 ******************************************************************************/

//convert FN_... to RES_ in header and footer itemset
sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
{
    sal_uInt16 nRes = USHRT_MAX;
    switch(nFNId)
    {
        case FN_UNO_FOOTER_ON:
        case FN_UNO_HEADER_ON:
        break;
        case FN_UNO_FOOTER_BACKGROUND:
        case FN_UNO_HEADER_BACKGROUND:      nRes = RES_BACKGROUND;
        break;
        case FN_UNO_FOOTER_BOX:
        case FN_UNO_HEADER_BOX:             nRes = RES_BOX;
        break;
        case FN_UNO_FOOTER_LR_SPACE:
        case FN_UNO_HEADER_LR_SPACE:        nRes = RES_LR_SPACE;
        break;
        case FN_UNO_FOOTER_SHADOW:
        case FN_UNO_HEADER_SHADOW:          nRes = RES_SHADOW;
        break;
        case FN_UNO_FOOTER_BODY_DISTANCE:
        case FN_UNO_HEADER_BODY_DISTANCE:   nRes = RES_UL_SPACE;
        break;
        case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
        case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
        break;
        case FN_UNO_FOOTER_SHARE_CONTENT:
        case FN_UNO_HEADER_SHARE_CONTENT:   nRes = SID_ATTR_PAGE_SHARED;
        break;
        case FN_UNO_FOOTER_HEIGHT:
        case FN_UNO_HEADER_HEIGHT:          nRes = SID_ATTR_PAGE_SIZE;
        break;
        case FN_UNO_FOOTER_EAT_SPACING:
        case FN_UNO_HEADER_EAT_SPACING:   nRes = RES_HEADER_FOOTER_EAT_SPACING;
        break;
    }
    return nRes;

}

SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily )
{
    switch ( eFamily )
@@ -1738,99 +1697,138 @@ void    SwXStyle::ApplyDescriptorProperties()
/*-- 18.04.01 13:07:27---------------------------------------------------

  -----------------------------------------------------------------------*/
struct SwStyleBase_Impl
class SwStyleBase_Impl
{
    SwDoc&              rDoc;
private:
    SwDoc&                              mrDoc;
    const SwPageDesc*                   mpOldPageDesc;
    rtl::Reference< SwDocStyleSheet >   mxNewBase;
    SfxItemSet*                         mpItemSet;
    const String&                       mrStyleName;
    sal_uInt16                          mnPDescPos;
    const SwAttrSet*                    mpParentStyle;

    const SwPageDesc*   pOldPageDesc;
public:
    SwStyleBase_Impl(
        SwDoc& rSwDoc,
        const String& rName,
        const SwAttrSet* pParentStyle)
    :   mrDoc(rSwDoc),
        mpOldPageDesc(0),
        mxNewBase(),
        mpItemSet(0),
        mrStyleName(rName),
        mnPDescPos(0xffff),
        mpParentStyle(pParentStyle)
    {
    }

    rtl::Reference< SwDocStyleSheet > mxNewBase;
    SfxItemSet*         pItemSet;
    ~SwStyleBase_Impl()
    {
        delete mpItemSet;
    }

    const String&       rStyleName;
    sal_uInt16              nPDescPos;
    rtl::Reference< SwDocStyleSheet >& getNewBase()
    {
        return mxNewBase;
    }

    SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) :
        rDoc(rSwDoc),
        pOldPageDesc(0),
        pItemSet(0),
        rStyleName(rName),
        nPDescPos(0xffff)
        {}
    void setNewBase(SwDocStyleSheet* pNew)
    {
        mxNewBase = pNew;
    }

    ~SwStyleBase_Impl(){ delete pItemSet; }
    sal_Bool HasItemSet()
    {
        return mxNewBase.is();
    }

    sal_Bool HasItemSet() {return mxNewBase.is();}
    SfxItemSet* replaceItemSet(SfxItemSet* pNew)
    {
        SfxItemSet* pRetval = mpItemSet;
        mpItemSet = pNew;
        return pRetval;
    }

    SfxItemSet& GetItemSet()
    {
        DBG_ASSERT(mxNewBase.is(), "no SwDocStyleSheet available");

        if(!mpItemSet)
        {
            DBG_ASSERT(mxNewBase.is(), "no SwDocStyleSheet available");
            if(!pItemSet)
                pItemSet = new SfxItemSet(mxNewBase->GetItemSet());
            return *pItemSet;
            mpItemSet = new SfxItemSet(mxNewBase->GetItemSet());

            //UUUU set parent style to have the correct XFillStyle setting as XFILL_NONE
            if(!mpItemSet->GetParent() && mpParentStyle)
            {
                mpItemSet->SetParent(mpParentStyle);
            }
        }

        const SwPageDesc& GetOldPageDesc();
        return *mpItemSet;
    }

    const SwPageDesc& GetOldPageDesc();
};
/* -----------------------------25.04.01 12:44--------------------------------

 ---------------------------------------------------------------------------*/
const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
{
    if(!pOldPageDesc)
    if(!mpOldPageDesc)
    {
        sal_uInt16 i;
        sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
        sal_uInt16 nPDescCount = mrDoc.GetPageDescCnt();
        for(i = 0; i < nPDescCount; i++)
        {
            const SwPageDesc& rDesc =
                const_cast<const SwDoc &>(rDoc).GetPageDesc( i );
            if(rDesc.GetName() == rStyleName)
                const_cast<const SwDoc &>(mrDoc).GetPageDesc( i );
            if(rDesc.GetName() == mrStyleName)
            {
                pOldPageDesc = & rDesc;
                nPDescPos = i;
                mpOldPageDesc = & rDesc;
                mnPDescPos = i;
                break;
            }
        }
        if(!pOldPageDesc)
        if(!mpOldPageDesc)
        {
            for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
            {
                const String aFmtName(SW_RES(i));
                if(aFmtName == rStyleName)
                if(aFmtName == mrStyleName)
                {
                    pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
                    mpOldPageDesc = mrDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
                    break;
                }
            }
            for(i = 0; i < nPDescCount + 1; i++)
            {
                const SwPageDesc& rDesc =
                    const_cast<const SwDoc &>(rDoc).GetPageDesc( i );
                if(rDesc.GetName() == rStyleName)
                    const_cast<const SwDoc &>(mrDoc).GetPageDesc( i );
                if(rDesc.GetName() == mrStyleName)
                {
                    nPDescPos = i;
                    mnPDescPos = i;
                    break;
                }
            }
        }
    }
    return *pOldPageDesc;
    return *mpOldPageDesc;
}

/* -----------------------------19.04.01 09:44--------------------------------

 ---------------------------------------------------------------------------*/

void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                        const SfxItemPropertySet& rPropSet,
                        const uno::Any& rValue,
                        SwStyleBase_Impl& rBase,
                        SfxStyleSheetBasePool* pBasePool,
                        SwDoc* pDoc,
                        SfxStyleFamily eFamily)
                            throw(beans::PropertyVetoException, lang::IllegalArgumentException,
                                lang::WrappedTargetException, uno::RuntimeException)

void lcl_SetStyleProperty(
    const SfxItemPropertySimpleEntry& rEntry,
    const SfxItemPropertySet& rPropSet,
    const uno::Any& rValue,
    SwStyleBase_Impl& rBase,
    SfxStyleSheetBasePool* pBasePool,
    SwDoc* pDoc,
    SfxStyleFamily eFamily)
throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    //UUUU adapted switch logic to a more readable state; removed goto's and made
    // execution of standard setting of proerty in ItemSet dependent of this variable
@@ -1871,18 +1869,18 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,

    switch(rEntry.nWID)
    {
        case XATTR_FILLBITMAP:
        case XATTR_FILLGRADIENT:
        case XATTR_FILLHATCH:
        case XATTR_FILLBITMAP:
        case XATTR_FILLFLOATTRANSPARENCE:
        // not yet needed; activate when LineStyle support may be added
        // case XATTR_LINESTART:
        // case XATTR_LINEEND:
        // case XATTR_LINEDASH:
        {
            //UUUU add set commands for FillName items
            if(MID_NAME == nMemberId)
            {
                //UUUU add set commands for FillName items
                OUString aTempName;
                SfxItemSet& rStyleSet = rBase.GetItemSet();

@@ -1894,21 +1892,28 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                SvxShape::SetFillAttribute(rEntry.nWID, aTempName, rStyleSet);
                bDone = true;
            }
            else if(MID_GRAFURL == nMemberId)
            {
                if(XATTR_FILLBITMAP == rEntry.nWID)
                {
                    //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
                    const Graphic aNullGraphic;
                    SfxItemSet& rStyleSet = rBase.GetItemSet();
                    XFillBitmapItem aXFillBitmapItem(rStyleSet.GetPool(), aNullGraphic);

                    aXFillBitmapItem.PutValue(aValue, nMemberId);
                    rStyleSet.Put(aXFillBitmapItem);
                    bDone = true;
                }
            }

            break;
        }
        case RES_BACKGROUND:
        {
            //UUUU No new FillStyle for PageBackground; need to remove again when we want
            // to support that, too. Add a break to *not* set bDone to true
            if(SFX_STYLE_FAMILY_PAGE == eFamily)
            {
                break;
            }

            //UUUU
            SfxItemSet& rStyleSet = rBase.GetItemSet();
            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
            const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND));
            SvxBrushItem aChangedBrushItem(aOriginalBrushItem);

            aChangedBrushItem.PutValue(aValue, nMemberId);
@@ -2061,7 +2066,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                            aSetRule.Set( i, &aFmt );
                        }
                    }
                    rBase.mxNewBase->SetNumRule(aSetRule);
                    rBase.getNewBase()->SetNumRule(aSetRule);
                }
            }
            else
@@ -2074,9 +2079,9 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
        //{
        //    sal_Int8 nLevel = 0;
        //    if( aValue >>= nLevel )
        //        rBase.mxNewBase->GetCollection()->SetOutlineLevel( nLevel );
        //        rBase.getNewBase()->GetCollection()->SetOutlineLevel( nLevel );
        //    else
        //        rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING );
        //        rBase.getNewBase()->GetCollection()->SetOutlineLevel( NO_NUMBERING );
        //
        //    bDone = true;
        //    break;
@@ -2086,7 +2091,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            sal_Int16 nLevel = 0;
            aValue >>= nLevel;
            if( 0 <= nLevel && nLevel <= MAXLEVEL)
                rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel );
                rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel );

            bDone = true;
            break;  //<-end,zhaojianwei
@@ -2097,7 +2102,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            aValue >>= sTmp;
            String aString;
            SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True ) ;
            rBase.mxNewBase->SetFollow( aString );
            rBase.getNewBase()->SetFollow( aString );

            bDone = true;
            break;
@@ -2159,9 +2164,9 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
        {
            sal_Bool bAuto = *(sal_Bool*)aValue.getValue();
            if(SFX_STYLE_FAMILY_PARA == eFamily)
                rBase.mxNewBase->GetCollection()->SetAutoUpdateFmt(bAuto);
                rBase.getNewBase()->GetCollection()->SetAutoUpdateFmt(bAuto);
            else if(SFX_STYLE_FAMILY_FRAME == eFamily)
                rBase.mxNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto);
                rBase.getNewBase()->GetFrmFmt()->SetAutoUpdateFmt(bAuto);

            bDone = true;
            break;
@@ -2222,7 +2227,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
        }
        case FN_UNO_CATEGORY:
        {
            if(!rBase.mxNewBase->IsUserDefined())
            if(!rBase.getNewBase()->IsUserDefined())
                throw lang::IllegalArgumentException();
            short nSet = 0;
            aValue >>= nSet;
@@ -2251,7 +2256,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                default: throw lang::IllegalArgumentException();
            }

            rBase.mxNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF );
            rBase.getNewBase()->SetMask( nId|SFXSTYLEBIT_USERDEF );
            bDone = true;
            break;
        }
@@ -2353,9 +2358,9 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
        // --> OD 2006-10-18 #i70223#
        if ( SFX_STYLE_FAMILY_PARA == eFamily &&
                rEntry.nWID == RES_PARATR_NUMRULE &&
                rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() &&
                //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
                rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() )       ////<-end,add by zhaojianwei
                rBase.getNewBase().is() && rBase.getNewBase()->GetCollection() &&
                //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */)  //#outline level,removed by zhaojianwei
                rBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle() )        ////<-end,add by zhaojianwei
        {
            OUString sNewNumberingRuleName;
            aValue >>= sNewNumberingRuleName;
@@ -2363,8 +2368,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            if ( sNewNumberingRuleName.getLength() == 0 || sTmp != pDoc->GetOutlineNumRule()->GetName() )
            {
                // delete assignment to list level of outline style.
                //rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING );            //#outline level,removed by zhaojianwei
                rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();  //<-end,adde by zhaojianwei
                //rBase.getNewBase()->GetCollection()->SetOutlineLevel( NO_NUMBERING );         //#outline level,removed by zhaojianwei
                rBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();   //<-end,adde by zhaojianwei
            }
        }
    }
@@ -2375,31 +2380,34 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
void SAL_CALL SwXStyle::SetPropertyValues_Impl(
    const uno::Sequence< OUString >& rPropertyNames,
    const uno::Sequence< uno::Any >& rValues )
    throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
            lang::WrappedTargetException, uno::RuntimeException)
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    if ( !m_pDoc )
        throw uno::RuntimeException();

    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;

    switch(eFamily)
    {
        case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
        case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
        case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE  ;break;
        case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
        default:
            ;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();

    if(rPropertyNames.getLength() != rValues.getLength())
    {
        throw lang::IllegalArgumentException();
    }

    const OUString* pNames = rPropertyNames.getConstArray();
    const uno::Any* pValues = rValues.getConstArray();
    SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent

    SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName);
    if(pBasePool)
    {
        sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
@@ -2407,43 +2415,50 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
        SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
        pBasePool->SetSearchMask(eFamily, nSaveMask );
        DBG_ASSERT(pBase, "where is the style?" );

        if(pBase)
            aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
            aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase));
        else
            throw uno::RuntimeException();
    }

    for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    {
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]);
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[nProp]);

        if(!pEntry ||
           (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS))))
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
        if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
            throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
        if(aBaseImpl.mxNewBase.is())

        if(aBaseImpl.getNewBase().is())
        {
            lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
                                 pBasePool, m_pDoc, eFamily);
            lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, pBasePool, m_pDoc, eFamily);
        }
        else if(bIsDescriptor)
        {
            if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp]))
            {
                throw lang::IllegalArgumentException();
            }
        }
        else
        {
            throw uno::RuntimeException();
        }
    }

    if(aBaseImpl.HasItemSet())
        aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
    {
        aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet());
    }
}

void SwXStyle::setPropertyValues(
    const uno::Sequence< OUString >& rPropertyNames,
    const uno::Sequence< uno::Any >& rValues )
        throw(beans::PropertyVetoException, lang::IllegalArgumentException,
                lang::WrappedTargetException, uno::RuntimeException)
throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());

@@ -2463,12 +2478,14 @@ void SwXStyle::setPropertyValues(
}


uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
                        const SfxItemPropertySet& rPropSet,
                        SwStyleBase_Impl& rBase,
                        SfxStyleSheetBase* pBase,
                        SfxStyleFamily eFamily,
                        SwDoc *pDoc) throw(uno::RuntimeException)
uno::Any lcl_GetStyleProperty(
    const SfxItemPropertySimpleEntry& rEntry,
    const SfxItemPropertySet& rPropSet,
    SwStyleBase_Impl& rBase,
    SfxStyleSheetBase* pBase,
    SfxStyleFamily eFamily,
    SwDoc *pDoc)
throw(uno::RuntimeException)
{
    uno::Any aRet;

@@ -2488,9 +2505,9 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
    }
    else if(pBase)
    {
        if(!rBase.mxNewBase.is())
        if(!rBase.getNewBase().is())
        {
            rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase );
            rBase.setNewBase(new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ));
        }

        //UUUU
@@ -2524,7 +2541,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            }
            case  FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
            {
                const SwNumRule* pRule = rBase.mxNewBase->GetNumRule();
                const SwNumRule* pRule = rBase.getNewBase()->GetNumRule();
                DBG_ASSERT(pRule, "Wo ist die NumRule?");
                uno::Reference< container::XIndexReplace >  xRules = new SwXNumberingRules(*pRule);

@@ -2536,7 +2553,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            //case FN_UNO_DEFAULT_OUTLINE_LEVEL:        //#outline level,removed by zahojianwei
            //{
            //    DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" );
            //    sal_uInt8 nLevel = rBase.mxNewBase->GetCollection()->GetOutlineLevel();
            //    sal_uInt8 nLevel = rBase.getNewBase()->GetCollection()->GetOutlineLevel();
            //    if( nLevel != NO_NUMBERING )
            //        aRet <<= static_cast<sal_Int8>( nLevel );
            //    bDone = true;
@@ -2545,7 +2562,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            case RES_PARATR_OUTLINELEVEL:               //add by zahojianwei
            {
                DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" );
                int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel();
                int nLevel = rBase.getNewBase()->GetCollection()->GetAttrOutlineLevel();

                aRet <<= static_cast<sal_Int16>( nLevel );
                bDone = true;
@@ -2555,7 +2572,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            {
                String aString;

                SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
                SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
                aRet <<= OUString( aString );
                bDone = true;
                break;
@@ -2586,9 +2603,9 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            {
                sal_Bool bAuto = sal_False;
                if(SFX_STYLE_FAMILY_PARA == eFamily)
                    bAuto = rBase.mxNewBase->GetCollection()->IsAutoUpdateFmt();
                    bAuto = rBase.getNewBase()->GetCollection()->IsAutoUpdateFmt();
                else if(SFX_STYLE_FAMILY_FRAME == eFamily)
                    bAuto = rBase.mxNewBase->GetFrmFmt()->IsAutoUpdateFmt();
                    bAuto = rBase.getNewBase()->GetFrmFmt()->IsAutoUpdateFmt();
                aRet.setValue(&bAuto, ::getBooleanCppuType());

                bDone = true;
@@ -2596,7 +2613,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            }
            case FN_UNO_DISPLAY_NAME:
            {
                OUString sName(rBase.mxNewBase->GetDisplayName());
                OUString sName(rBase.getNewBase()->GetDisplayName());
                aRet <<= sName;

                bDone = true;
@@ -2637,7 +2654,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            }
            case FN_UNO_CATEGORY:
            {
                sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
                sal_uInt16 nPoolId = rBase.getNewBase()->GetCollection()->GetPoolFmtId();
                short nRet = -1;

                switch ( COLL_GET_RANGE_BITS & nPoolId )
@@ -2668,7 +2685,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            }
            case SID_SWREGISTER_COLLECTION:
            {
                const SwPageDesc *pPageDesc = rBase.mxNewBase->GetPageDesc();
                const SwPageDesc *pPageDesc = rBase.getNewBase()->GetPageDesc();
                const SwTxtFmtColl* pCol = 0;
                String aString;
                if( pPageDesc )
@@ -2683,16 +2700,9 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
            }
            case RES_BACKGROUND:
            {
                //UUUU No new FillStyle for PageBackground; need to remove again when we want
                // to support that, too. Add a break to *not* set bDone to true
                if(SFX_STYLE_FAMILY_PAGE == eFamily)
                {
                    break;
                }

                //UUUU
                const SfxItemSet& rSet = rBase.GetItemSet();
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
                const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));

                if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
                {
@@ -2787,35 +2797,38 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,

 ---------------------------------------------------------------------------*/
uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
        const uno::Sequence< OUString > & rPropertyNames )
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    const uno::Sequence< OUString > & rPropertyNames )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    if ( !m_pDoc )
        throw uno::RuntimeException();

    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;

    switch(eFamily)
    {
        case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
        case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
        case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE  ;break;
        case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
        default:
            ;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();

    const OUString* pNames = rPropertyNames.getConstArray();
    uno::Sequence< uno::Any > aRet(rPropertyNames.getLength());
    uno::Any* pRet = aRet.getArray();
    SwStyleBase_Impl aBase(*m_pDoc, sStyleName);
    SwStyleBase_Impl aBase(*m_pDoc, sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent
    SfxStyleSheetBase* pBase = 0;

    for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    {
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]);
        if(!pEntry ||
           (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS))))
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );

        if(pBasePool)
        {
            if(!pBase)
@@ -2825,6 +2838,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
                pBase = pBasePool->Find(sStyleName);
                pBasePool->SetSearchMask(eFamily, nSaveMask );
            }

            pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() );
        }
        else if(bIsDescriptor)
@@ -2884,7 +2898,8 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(

 ---------------------------------------------------------------------------*/
uno::Sequence< uno::Any > SwXStyle::getPropertyValues(
    const uno::Sequence< OUString >& rPropertyNames ) throw(uno::RuntimeException)
    const uno::Sequence< OUString >& rPropertyNames )
throw(uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    uno::Sequence< uno::Any > aValues;
@@ -2910,7 +2925,7 @@ uno::Sequence< uno::Any > SwXStyle::getPropertyValues(
void SwXStyle::addPropertiesChangeListener(
    const uno::Sequence< OUString >& /*aPropertyNames*/,
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
        throw(uno::RuntimeException)
throw(uno::RuntimeException)
{
}
/*-- 18.04.01 13:07:30---------------------------------------------------
@@ -2918,7 +2933,7 @@ void SwXStyle::addPropertiesChangeListener(
  -----------------------------------------------------------------------*/
void SwXStyle::removePropertiesChangeListener(
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
        throw(uno::RuntimeException)
throw(uno::RuntimeException)
{
}
/*-- 18.04.01 13:07:30---------------------------------------------------
@@ -2927,29 +2942,29 @@ void SwXStyle::removePropertiesChangeListener(
void SwXStyle::firePropertiesChangeEvent(
    const uno::Sequence< OUString >& /*aPropertyNames*/,
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
        throw(uno::RuntimeException)
throw(uno::RuntimeException)
{
}
/*-- 17.12.98 08:26:53---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
    throw( beans::UnknownPropertyException,
        beans::PropertyVetoException,
        lang::IllegalArgumentException,
        lang::WrappedTargetException,
        uno::RuntimeException)
void SwXStyle::setPropertyValue(
    const OUString& rPropertyName,
    const uno::Any& rValue)
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    const uno::Sequence<uno::Any> aValues(&rValue, 1);

    SetPropertyValues_Impl( aProperties, aValues );
}
/*-- 17.12.98 08:26:53---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
uno::Any SwXStyle::getPropertyValue(
    const OUString& rPropertyName)
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
@@ -2959,36 +2974,40 @@ uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
/*-- 17.12.98 08:26:53---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::addPropertyChangeListener(const OUString& /*rPropertyName*/,
void SwXStyle::addPropertyChangeListener(
    const OUString& /*rPropertyName*/,
    const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    DBG_WARNING("not implemented");
}
/*-- 17.12.98 08:26:54---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::removePropertyChangeListener(const OUString& /*rPropertyName*/,
void SwXStyle::removePropertyChangeListener(
    const OUString& /*rPropertyName*/,
    const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    DBG_WARNING("not implemented");
}
/*-- 17.12.98 08:26:54---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::addVetoableChangeListener(const OUString& /*rPropertyName*/,
void SwXStyle::addVetoableChangeListener(
    const OUString& /*rPropertyName*/,
    const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    DBG_WARNING("not implemented");
}
/*-- 17.12.98 08:26:54---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/,
void SwXStyle::removeVetoableChangeListener(
    const OUString& /*rPropertyName*/,
    const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    DBG_WARNING("not implemented");
}
@@ -2996,11 +3015,11 @@ void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/,
/*-- 08.03.99 10:50:26---------------------------------------------------

  -----------------------------------------------------------------------*/
beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
        throw( beans::UnknownPropertyException, uno::RuntimeException )
beans::PropertyState SwXStyle::getPropertyState(
    const OUString& rPropertyName)
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
    vos::OGuard aGuard(Application::GetSolarMutex());

    uno::Sequence< OUString > aNames(1);
    OUString* pNames = aNames.getArray();
    pNames[0] = rPropertyName;
@@ -3010,13 +3029,15 @@ beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
/*-- 08.03.99 10:50:27---------------------------------------------------

  -----------------------------------------------------------------------*/

uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
    const uno::Sequence< OUString >& rPropertyNames)
        throw( beans::UnknownPropertyException, uno::RuntimeException )
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
    beans::PropertyState* pStates = aRet.getArray();

    if(pBasePool)
    {
        pBasePool->SetSearchMask(eFamily );
@@ -3028,75 +3049,110 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
            const OUString* pNames = rPropertyNames.getConstArray();
            rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
            sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;

            switch(eFamily)
            {
                case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
                case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
                case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE;   break;
                case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
                default:
                    ;
                default: ;
            }

            const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
            const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
            const SfxItemSet& rSet = xStyle->GetItemSet();

            SfxItemSet aSet = xStyle->GetItemSet();
            for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
            {
                const String& rPropName = pNames[i];
                const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName);
                bool bDone(false);

                if(!pEntry)
                {
                    throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
                if( FN_UNO_NUM_RULES ==  pEntry->nWID ||
                    FN_UNO_FOLLOW_STYLE == pEntry->nWID )
                {
                    pStates[i] = beans::PropertyState_DIRECT_VALUE;
                }
        //        else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pEntry->nWID )    //#outline level,removed by zahojianwei
        //        {
        //            pStates[i] =
        //                ( xStyle->GetCollection()->GetOutlineLevel()
        //                  == NO_NUMBERING )
        //                ? beans::PropertyState_DEFAULT_VALUE
        //                : beans::PropertyState_DIRECT_VALUE;
        //        }                                                     //<-end,zhaojianwei
                else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
                        (rPropName.EqualsAscii("Header", 0, 6)
                            || rPropName.EqualsAscii("Footer", 0, 6)))

                if( FN_UNO_NUM_RULES ==  pEntry->nWID || FN_UNO_FOLLOW_STYLE == pEntry->nWID )
                {
                    sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID);
                    sal_Bool bFooter = rPropName.EqualsAscii("Footer", 0, 6);
                    const SvxSetItem* pSetItem;
                    if(SFX_ITEM_SET == aSet.GetItemState(
                            bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
                            sal_False, (const SfxPoolItem**)&pSetItem))
                    // handle NumRules first, done
                    pStates[i] = beans::PropertyState_DIRECT_VALUE;
                    bDone = true;
                }

                // allow to retarget the SfxItemSet working on, default correctly. Only
                // use pSourceSet below this point (except in header/footer processing)
                const SfxItemSet* pSourceSet = &rSet;

                if(!bDone)
                {
                    // check for Header/Footer entry
                    const bool bHeader(SFX_STYLE_FAMILY_PAGE == eFamily && rPropName.EqualsAscii("Header", 0, 6));
                    const bool bFooter(SFX_STYLE_FAMILY_PAGE == eFamily && rPropName.EqualsAscii("Footer", 0, 6));

                    if(bHeader || bFooter)
                    {
                        const SfxItemSet& rSet = pSetItem->GetItemSet();
                        SfxItemState eState = rSet.GetItemState(nResId, sal_False);
                        if(SFX_ITEM_SET == eState)
                            pStates[i] = beans::PropertyState_DIRECT_VALUE;
                        const SvxSetItem* pSetItem;

                        if(SFX_ITEM_SET == rSet.GetItemState(
                            bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
                            sal_False,
                            (const SfxPoolItem**)&pSetItem))
                        {
                            // retarget the SfxItemSet to the HeaderFooter SfxSetItem's SfxItenSet
                            pSourceSet = &pSetItem->GetItemSet();
                        }
                        else
                            pStates[i] = beans::PropertyState_DEFAULT_VALUE;
                        {
                            // if no SetItem, value is ambigous and we are done
                            pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
                            bDone = true;
                        }
                    }
                }

                if(!bDone && OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
                {
                    //UUUU
                    if(SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_STRETCH, false)
                        || SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_TILE, false))
                    {
                        pStates[i] = beans::PropertyState_DIRECT_VALUE;
                    }
                    else
                        pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
                }
                else
                {
                    pStates[i] = pPropSet->getPropertyState(*pEntry, aSet);
                    if( SFX_STYLE_FAMILY_PAGE == eFamily &&
                        SID_ATTR_PAGE_SIZE == pEntry->nWID &&
                        beans::PropertyState_DIRECT_VALUE == pStates[i] )
                    {
                        const SvxSizeItem& rSize =
                            static_cast < const SvxSizeItem& >(
                                    aSet.Get(SID_ATTR_PAGE_SIZE) );
                        pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
                    }

                    bDone = true;
                }

                //UUUU for FlyFrames we need to mark all properties from type RES_BACKGROUND
                // as beans::PropertyState_DIRECT_VALUE to let users of this property call
                // getPropertyValue where the member properties will be mapped from the
                // fill attributes to the according SvxBrushItem entries
                if(!bDone && RES_BACKGROUND == pEntry->nWID
                    && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*pSourceSet))
                {
                    pStates[i] = beans::PropertyState_DIRECT_VALUE;
                    bDone = true;
                }

                if(!bDone)
                {
                    pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet);

                    if(SFX_STYLE_FAMILY_PAGE == eFamily && SID_ATTR_PAGE_SIZE == pEntry->nWID && beans::PropertyState_DIRECT_VALUE == pStates[i])
                    {
                        const SvxSizeItem& rSize = static_cast <const SvxSizeItem&>( rSet.Get(SID_ATTR_PAGE_SIZE));
                        sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f;
                        if( ( LONG_MAX == rSize.GetSize().Width() &&
                              (MID_SIZE_WIDTH == nMemberId ||
                               MID_SIZE_SIZE == nMemberId ) ) ||
                            ( LONG_MAX == rSize.GetSize().Height() &&
                              MID_SIZE_HEIGHT == nMemberId ) )

                        if((LONG_MAX == rSize.GetSize().Width() &&
                            (MID_SIZE_WIDTH == nMemberId ||
                            MID_SIZE_SIZE == nMemberId)) ||
                            (LONG_MAX == rSize.GetSize().Height() &&
                            MID_SIZE_HEIGHT == nMemberId))
                        {
                            pStates[i] = beans::PropertyState_DEFAULT_VALUE;
                        }
@@ -3105,24 +3161,31 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
            }
        }
        else
        {
            throw uno::RuntimeException();
        }
    }
    else
    {
        throw uno::RuntimeException();
    }

    return aRet;
}
/*-- 08.03.99 10:50:27---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXStyle::setPropertyToDefault(const OUString& rPropertyName)
        throw( beans::UnknownPropertyException, uno::RuntimeException )
void SwXStyle::setPropertyToDefault(
    const OUString& rPropertyName)
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
    const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
    setPropertiesToDefault ( aSequence );
    const uno::Sequence < OUString > aSequence(&rPropertyName,1);
    setPropertiesToDefault(aSequence);
}

void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
    throw (beans::UnknownPropertyException, uno::RuntimeException)
void SAL_CALL SwXStyle::setPropertiesToDefault(
    const uno::Sequence< OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    SwFmt *pTargetFmt = 0;
@@ -3135,75 +3198,112 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >&

        if(pBase)
        {
            rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
            rtl::Reference< SwDocStyleSheet > xStyle(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase));
            switch(eFamily)
            {
                case SFX_STYLE_FAMILY_CHAR: pTargetFmt = xStyle->GetCharFmt(); break;
                case SFX_STYLE_FAMILY_PARA: pTargetFmt = xStyle->GetCollection(); break;
                case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break;
                case SFX_STYLE_FAMILY_CHAR:
                    pTargetFmt = xStyle->GetCharFmt();
                    break;

                case SFX_STYLE_FAMILY_PARA:
                    pTargetFmt = xStyle->GetCollection();
                    break;

                case SFX_STYLE_FAMILY_FRAME:
                    pTargetFmt = xStyle->GetFrmFmt();
                    break;

                case SFX_STYLE_FAMILY_PAGE:
                {
                    sal_uInt16 nPgDscPos = USHRT_MAX;
                    SwPageDesc *pDesc = m_pDoc->FindPageDescByName(xStyle->GetPageDesc()->GetName(),&nPgDscPos);

                    if(pDesc)
                    {
                        sal_uInt16 nPgDscPos = USHRT_MAX;
                        SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
                        if( pDesc )
                            pTargetFmt = &pDesc->GetMaster();
                        pTargetFmt = &pDesc->GetMaster();
                    }
                    break;
                }
                case SFX_STYLE_FAMILY_PSEUDO:
                    break;
                default:
                    ;
                default: ;
            }
        }
    }

    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;

    switch(eFamily)
    {
        case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
        case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
        case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
        case SFX_STYLE_FAMILY_PARA: nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
        case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
        case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
        case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
        default:
            ;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();

    const OUString* pNames = aPropertyNames.getConstArray();

    if ( pTargetFmt )
    if(pTargetFmt)
    {
        for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
        for(sal_Int32 nProp = 0,nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++)
        {
            const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
            if( !pEntry )
                throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
            if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES )
                throw uno::RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Cannot reset: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
            if ( pEntry->nFlags & beans::PropertyAttribute::READONLY )
                throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
            const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[nProp]);

            //if( pEntry->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL )     //#outline level, removed by zhaojianwei
            //  static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING );
            //else
            //  pTargetFmt->ResetFmtAttr( pEntry->nWID );
            if( pEntry->nWID == RES_PARATR_OUTLINELEVEL )                //add by zhaojianwei
            if(!pEntry)
            {
                throw beans::UnknownPropertyException(OUString(RTL_CONSTASCII_USTRINGPARAM("Property is unknown: ")) + pNames[nProp],static_cast <cppu::OWeakObject *> (this));
            }

            if(pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES)
            {
                throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot reset: ")) + pNames[nProp],static_cast <cppu::OWeakObject *> (this));
            }

            if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
            {
                throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("setPropertiesToDefault: property is read-only: ")) + pNames[nProp],static_cast <cppu::OWeakObject *> (this));
            }

            if(pEntry->nWID == RES_PARATR_OUTLINELEVEL)
            {
                static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle();
            }
            else
                pTargetFmt->ResetFmtAttr( pEntry->nWID );                //<-end,zhaojianwei
            {
                pTargetFmt->ResetFmtAttr(pEntry->nWID);
            }

            if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
            {
                //UUUU
                SwDoc* pDoc = pTargetFmt->GetDoc();
                SfxItemSet aSet(pDoc->GetAttrPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
                aSet.SetParent(&pTargetFmt->GetAttrSet());

                aSet.ClearItem(XATTR_FILLBMP_STRETCH);
                aSet.ClearItem(XATTR_FILLBMP_TILE);

                pTargetFmt->SetFmtAttr(aSet);
            }
        }
    }
    else if ( bIsDescriptor )
    else if(bIsDescriptor)
    {
        for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
            pPropImpl->ClearProperty ( pNames[ nProp ] );
        for(sal_Int32 nProp = 0,nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++)
        {
            pPropImpl->ClearProperty(pNames[nProp]);
        }
    }
}

void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
    throw (uno::RuntimeException)
void SAL_CALL SwXStyle::setAllPropertiesToDefault()
throw (uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());

    if(pBasePool)
    {
        pBasePool->SetSearchMask(eFamily);
@@ -3213,78 +3313,82 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
        if(pBase)
        {
            rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );

            SwFmt *pTargetFmt = 0;
            sal_uInt16 nPgDscPos = USHRT_MAX;
            switch( eFamily )

            switch(eFamily)
            {
            case SFX_STYLE_FAMILY_CHAR :
                pTargetFmt = xStyle->GetCharFmt();
                break;
            case SFX_STYLE_FAMILY_PARA :
                case SFX_STYLE_FAMILY_CHAR:
                    pTargetFmt = xStyle->GetCharFmt();
                    break;

                case SFX_STYLE_FAMILY_PARA:
                {
                    pTargetFmt = xStyle->GetCollection();
                    // --> OD 2007-07-25 #132402# - make code robust
                    if ( xStyle->GetCollection() )

                    if(xStyle->GetCollection())
                    {
                    //  xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING );               //#outline level,removed by zhaojianwei
                        //  xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING );               //#outline level,removed by zhaojianwei
                        xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();   //<-end,add by zhaojianwei
                    }
                    // <--
                    break;
                }
                break;
            case SFX_STYLE_FAMILY_FRAME:
                pTargetFmt = xStyle->GetFrmFmt();
                break;
            case SFX_STYLE_FAMILY_PAGE:

                case SFX_STYLE_FAMILY_FRAME:
                    pTargetFmt = xStyle->GetFrmFmt();
                    break;

                case SFX_STYLE_FAMILY_PAGE:
                {
                    SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
                    if( pDesc )
                    SwPageDesc *pDesc = m_pDoc->FindPageDescByName(xStyle->GetPageDesc()->GetName(),&nPgDscPos);

                    if(pDesc)
                    {
                        pTargetFmt = &pDesc->GetMaster();
                        pDesc->SetUseOn ( nsUseOnPage::PD_ALL );
                        pDesc->SetUseOn(nsUseOnPage::PD_ALL);
                    }
                    break;
                }
                break;
            case SFX_STYLE_FAMILY_PSEUDO:
                break;

            default:
                ;
                case SFX_STYLE_FAMILY_PSEUDO:
                    break;

                default: ;
            }
            if( pTargetFmt )

            if(pTargetFmt)
            {
                if( USHRT_MAX != nPgDscPos )
                if(USHRT_MAX != nPgDscPos)
                {
                    SwPageDesc& rPageDesc = m_pDoc->_GetPageDesc(nPgDscPos);
                    rPageDesc.ResetAllMasterAttr();

                    SvxLRSpaceItem aLR(RES_LR_SPACE);
                    sal_Int32 nSize = GetMetricVal ( CM_1) * 2;
                    aLR.SetLeft ( nSize );
                    aLR.SetLeft ( nSize );
                    SvxULSpaceItem aUL( RES_UL_SPACE );
                    aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) );
                    aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) );
                    pTargetFmt->SetFmtAttr( aLR );
                    pTargetFmt->SetFmtAttr( aUL );
                    sal_Int32 nSize = GetMetricVal(CM_1) * 2;
                    aLR.SetLeft(nSize);
                    aLR.SetLeft(nSize);
                    SvxULSpaceItem aUL(RES_UL_SPACE);
                    aUL.SetUpper(static_cast <sal_uInt16> (nSize));
                    aUL.SetLower(static_cast <sal_uInt16> (nSize));
                    pTargetFmt->SetFmtAttr(aLR);
                    pTargetFmt->SetFmtAttr(aUL);
                    SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD);
                    SwFmtFrmSize aFrmSz(ATT_FIX_SIZE);

                    SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
                    SwFmtFrmSize aFrmSz( ATT_FIX_SIZE );
                    if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() )
                    if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId())
                    {
                        if( m_pDoc->getPrinter( false ) )
                        if(m_pDoc->getPrinter(false))
                        {
                            const Size aPhysSize( SvxPaperInfo::GetPaperSize(
                                        static_cast<Printer*>( m_pDoc->getPrinter( false ) )) );
                            aFrmSz.SetSize( aPhysSize );
                            const Size aPhysSize(SvxPaperInfo::GetPaperSize(
                                static_cast<Printer*>(m_pDoc->getPrinter(false))));
                            aFrmSz.SetSize(aPhysSize);
                        }
                        else
                        {
                            // --> OD 2008-07-25 #i91928#
//                            aFrmSz.SetWidth( LONG_MAX );
//                            aFrmSz.SetHeight( LONG_MAX );
                            aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() );
                            //                            aFrmSz.SetWidth( LONG_MAX );
                            //                            aFrmSz.SetHeight( LONG_MAX );
                            aFrmSz.SetSize(SvxPaperInfo::GetDefaultPaperSize());
                            // <--
                        }

@@ -3293,13 +3397,15 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
                    {
                        aFrmSz = pStdPgDsc->GetMaster().GetFrmSize();
                    }
                    if( pStdPgDsc->GetLandscape() )

                    if(pStdPgDsc->GetLandscape())
                    {
                        SwTwips nTmp = aFrmSz.GetHeight();
                        aFrmSz.SetHeight( aFrmSz.GetWidth() );
                        aFrmSz.SetWidth( nTmp );
                        aFrmSz.SetHeight(aFrmSz.GetWidth());
                        aFrmSz.SetWidth(nTmp);
                    }
                    pTargetFmt->SetFmtAttr( aFrmSz );

                    pTargetFmt->SetFmtAttr(aFrmSz);
                }
                else
                {
@@ -3308,86 +3414,106 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
                    // <--
                }

                if( USHRT_MAX != nPgDscPos )
                    m_pDoc->ChgPageDesc( nPgDscPos,
                                         const_cast<const SwDoc *>(m_pDoc)
                                         ->GetPageDesc(nPgDscPos) );
                if(USHRT_MAX != nPgDscPos)
                {
                    m_pDoc->ChgPageDesc(nPgDscPos, const_cast<const SwDoc *>(m_pDoc)->GetPageDesc(nPgDscPos));
                }
            }

        }
        else
        {
            throw uno::RuntimeException();
        }
    }
    else if ( bIsDescriptor )
    else if(bIsDescriptor)
    {
        pPropImpl->ClearAllProperties();
    }
    else
    {
        throw uno::RuntimeException();
    }
}

uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
    throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults(
    const uno::Sequence< OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    sal_Int32 nCount = aPropertyNames.getLength();
    uno::Sequence < uno::Any > aRet ( nCount );
    if ( nCount )
    uno::Sequence < uno::Any > aRet(nCount);

    if(nCount)
    {
        if( pBasePool)
        if(pBasePool)
        {
            pBasePool->SetSearchMask(eFamily);
            SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
            DBG_ASSERT(pBase, "Doesn't seem to be a style!");
            DBG_ASSERT(pBase,"Doesn't seem to be a style!");

            if(pBase)
            {
                rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
                rtl::Reference< SwDocStyleSheet > xStyle(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase));
                sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;

                switch(eFamily)
                {
                    case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
                    case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
                    case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
                    case SFX_STYLE_FAMILY_PARA: nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
                    case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
                    case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
                    case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
                    default:
                        ;
                    default: ;
                }

                const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
                const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();

                const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent();
                const SfxItemSet &rSet = xStyle->GetItemSet(),*pParentSet = rSet.GetParent();
                const OUString *pNames = aPropertyNames.getConstArray();
                uno::Any *pRet = aRet.getArray();
                for ( sal_Int32 i = 0 ; i < nCount; i++)
                {
                    const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[i] );
                    if ( !pEntry )
                        throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );

                    if( pParentSet )
                        aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]);
                    else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) )
                for(sal_Int32 i = 0; i < nCount; i++)
                {
                    const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[i]);

                    if(!pEntry)
                    {
                        throw beans::UnknownPropertyException(OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) + pNames[i],static_cast <cppu::OWeakObject *> (this));
                    }

                    if(pParentSet)
                    {
                        aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i],*pParentSet,pRet[i]);
                    }
                    else if(pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID))
                    {
                        const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID);

                        rItem.QueryValue(pRet[i], pEntry->nMemberId);
                    }
                }
            }
            else
            {
                throw uno::RuntimeException();
            }
        }
        else
        {
            throw uno::RuntimeException();
        }
    }
    return aRet;
}
/*-- 08.03.99 10:50:27---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
uno::Any SwXStyle::getPropertyDefault(
    const OUString& rPropertyName)
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
    return getPropertyDefaults ( aSequence ).getConstArray()[0];
    const uno::Sequence < OUString > aSequence(&rPropertyName,1);
    return getPropertyDefaults(aSequence).getConstArray()[0];
}
/* -----------------21.01.99 13:08-------------------
 *
@@ -3433,19 +3559,19 @@ void SwXStyle::Invalidate()
/*-- 17.12.98 08:43:35---------------------------------------------------

  -----------------------------------------------------------------------*/
SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool,
        SwDocShell* pDocSh, SfxStyleFamily eFam,
        const String& rStyleName)://, const SfxItemPropertyMap* _pMap) :
    SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName),//, _pMap),
SwXPageStyle::SwXPageStyle(
    SfxStyleSheetBasePool& rPool,
    SwDocShell* pDocSh, SfxStyleFamily eFam,
    const String& rStyleName)
:   SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName),
    pDocShell(pDocSh)
{

}
/* -----------------23.08.99 15:52-------------------

 --------------------------------------------------*/
SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) :
    SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE),
SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh)
:   SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE),
    pDocShell(pDocSh)
{
}
@@ -3463,8 +3589,7 @@ SwXPageStyle::~SwXPageStyle()
void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
    const uno::Sequence< OUString >& rPropertyNames,
    const uno::Sequence< uno::Any >& rValues )
    throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
            lang::WrappedTargetException, uno::RuntimeException)
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    if(!GetDoc())
        throw uno::RuntimeException();
@@ -3476,7 +3601,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
    const uno::Any* pValues = rValues.getConstArray();
    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
    const SfxItemPropertyMap*   pMap = pPropSet->getPropertyMap();
    SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
    SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent

    if(GetBasePool())
    {
        sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
@@ -3484,155 +3610,199 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
        SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
        GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
        DBG_ASSERT(pBase, "where is the style?" );

        if(pBase)
            aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
        {
            aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase));
        }
        else
        {
            throw uno::RuntimeException();
        }
    }

    for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    {
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
        const String& rPropName = pNames[nProp];
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName );

        if (!pEntry)
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
        {
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        }

        if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
            throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
        {
            throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        }

        if(GetBasePool())
        {
            switch(pEntry->nWID)
            {
                case FN_UNO_HEADER_ON:
                case FN_UNO_HEADER_BACKGROUND:
                case FN_UNO_HEADER_BOX:
                case FN_UNO_HEADER_LR_SPACE:
                case FN_UNO_HEADER_SHADOW:
                case FN_UNO_HEADER_BODY_DISTANCE:
                case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
                case FN_UNO_HEADER_SHARE_CONTENT:
                case FN_UNO_HEADER_HEIGHT:
                case FN_UNO_HEADER_EAT_SPACING:

                case FN_UNO_FOOTER_ON:
                case FN_UNO_FOOTER_BACKGROUND:
                case FN_UNO_FOOTER_BOX:
                case FN_UNO_FOOTER_LR_SPACE:
                case FN_UNO_FOOTER_SHADOW:
                case FN_UNO_FOOTER_BODY_DISTANCE:
                case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
                case FN_UNO_FOOTER_SHARE_CONTENT:
                case FN_UNO_FOOTER_HEIGHT:
                case FN_UNO_FOOTER_EAT_SPACING:
                case SID_ATTR_PAGE_ON:
                case RES_BACKGROUND:
                case RES_BOX:
                case RES_LR_SPACE:
                case RES_SHADOW:
                case RES_UL_SPACE:
                case SID_ATTR_PAGE_DYNAMIC:
                case SID_ATTR_PAGE_SHARED:
                case SID_ATTR_PAGE_SIZE:
                case RES_HEADER_FOOTER_EAT_SPACING:
                {
                    sal_Bool bSetItem = sal_False;
                    sal_Bool bFooter = sal_False;
                    sal_uInt16 nItemType = TYPE_BOOL;
                    sal_uInt16 nRes = 0;
                    switch(pEntry->nWID)
                    // these entries are used in Header, Footer and (partially) in the PageStyle itself.
                    // Check for Header/Footer entry
                    const bool bHeader(rPropName.EqualsAscii("Header", 0, 6));
                    const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6));

                    if(bHeader || bFooter)
                    {
                        case FN_UNO_FOOTER_ON:                  bFooter = sal_True;
                        //kein break;
                        case FN_UNO_HEADER_ON:                  nRes = SID_ATTR_PAGE_ON;
                        break;
                        case FN_UNO_FOOTER_BACKGROUND:          bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_BACKGROUND:          nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH;
                        break;
                        case FN_UNO_FOOTER_BOX:                 bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_BOX:                 nRes = RES_BOX; nItemType = TYPE_BOX;
                        break;
                        case FN_UNO_FOOTER_LR_SPACE:            bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_LR_SPACE:            nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE;
                        break;
                        case FN_UNO_FOOTER_SHADOW:              bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_SHADOW:              nRes = RES_SHADOW;nItemType = TYPE_SHADOW;
                        break;
                        case FN_UNO_FOOTER_BODY_DISTANCE:       bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_BODY_DISTANCE:       nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE;
                        break;
                        case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
                        break;
                        case FN_UNO_FOOTER_SHARE_CONTENT:       bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_SHARE_CONTENT:       nRes = SID_ATTR_PAGE_SHARED;
                        break;
                        case FN_UNO_FOOTER_HEIGHT:              bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_HEIGHT:              nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE;
                        break;
                        case FN_UNO_FOOTER_EAT_SPACING:     bFooter = sal_True;
                        // kein break;
                        case FN_UNO_HEADER_EAT_SPACING:     nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE;
                        break;
                    }
                    const SvxSetItem* pSetItem;
                    if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(
                            bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
                            sal_False, (const SfxPoolItem**)&pSetItem))
                    {
                        SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone();
                        SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
                        const SfxPoolItem* pItem = 0;
                        SfxPoolItem* pNewItem = 0;
                        rSetSet.GetItemState(nRes, sal_True, &pItem);
                        if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes))
                            pItem = &rSetSet.GetPool()->GetDefaultItem(nRes);
                        if(pItem)
                        // it is a Header/Footer entry, access the SvxSetItem containing it's information
                        const SvxSetItem* pSetItem = 0;

                        if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem))
                        {
                            pNewItem = pItem->Clone();
                            // create a new SvxSetItem and get it's ItemSet as new target
                            SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone());
                            SfxItemSet& rSetSet = pNewSetItem->GetItemSet();

                            // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
                            rSetSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet());

                            // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the
                            // default method to set the property
                            SfxItemSet* pRememberItemSet = aBaseImpl.replaceItemSet(&rSetSet);
                            lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
                            aBaseImpl.replaceItemSet(pRememberItemSet);

                            // reset paret at ItemSet from SetItem
                            rSetSet.SetParent(0);

                            // set the new SvxSetItem at the real target and delete it
                            aBaseImpl.GetItemSet().Put(*pNewSetItem);
                            delete pNewSetItem;
                        }
                        else
                        else if(pEntry->nWID == SID_ATTR_PAGE_ON)
                        {
                            switch(nItemType)
                            sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();

                            if(bVal)
                            {
                                case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes);       break;
                                case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes);       break;
                                case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes);     break;
                                case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break;
                                case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes);  break;
                                case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break;
                                case TYPE_BOX: pNewItem = new SvxBoxItem(nRes);         break;
                                // Header/footer gets switched on, create defauts and the needed SfxSetItem
                                SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(),
                                    RES_FRMATR_BEGIN,RES_FRMATR_END - 1,            // [82

                                    //UUUU FillAttribute support
                                    XATTR_FILL_FIRST, XATTR_FILL_LAST,              // [1014

                                    SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER,    // [10023
                                    SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE,          // [10051
                                    SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED,          // [10060
                                    0);

                                //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
                                aTempSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet());

                                aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_ON, sal_True));
                                aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50)));
                                aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
                                aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
                                aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, sal_True));
                                aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True));

                                SvxSetItem aNewSetItem(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, aTempSet);
                                aBaseImpl.GetItemSet().Put(aNewSetItem);
                            }
                        }
                        bSetItem = pNewItem->PutValue(pValues[nProp], pEntry->nMemberId);
                        rSetSet.Put(*pNewItem);
                        aBaseImpl.GetItemSet().Put(*pNewSetItem);
                        delete pNewItem;
                        delete pNewSetItem;
                    }
                    else if(SID_ATTR_PAGE_ON == nRes )
                    else
                    {
                        sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
                        if(bVal)
                        switch(pEntry->nWID)
                        {
                            SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(),
                                RES_BACKGROUND, RES_SHADOW,
                                RES_LR_SPACE, RES_UL_SPACE,
                                nRes, nRes,
                                SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
                                SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
                                SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
                                0 );
                            aTempSet.Put(SfxBoolItem(nRes, sal_True));
                            aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50)));
                            aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
                            aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
                            aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, sal_True));
                            aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True));

                            SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
                                    aTempSet);
                            aBaseImpl.GetItemSet().Put(aNewSetItem);
                            case SID_ATTR_PAGE_DYNAMIC:
                            case SID_ATTR_PAGE_SHARED:
                            case SID_ATTR_PAGE_ON:
                            case RES_HEADER_FOOTER_EAT_SPACING:
                            {
                                // these slots are exclusive to Header/Footer, thus this is an error
                                throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
                                break;
                            }
                            default:
                            {
                                // part of PageStyle, fallback to default
                                lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
                            }
                        }
                    }

                    break;
                }
                break;

                case XATTR_FILLBMP_SIZELOG:
                case XATTR_FILLBMP_TILEOFFSETX:
                case XATTR_FILLBMP_TILEOFFSETY:
                case XATTR_FILLBMP_POSOFFSETX:
                case XATTR_FILLBMP_POSOFFSETY:
                case XATTR_FILLBMP_POS:
                case XATTR_FILLBMP_SIZEX:
                case XATTR_FILLBMP_SIZEY:
                case XATTR_FILLBMP_STRETCH:
                case XATTR_FILLBMP_TILE:
                case OWN_ATTR_FILLBMP_MODE:
                case XATTR_FILLCOLOR:
                case XATTR_FILLBACKGROUND:
                case XATTR_FILLBITMAP:
                case XATTR_GRADIENTSTEPCOUNT:
                case XATTR_FILLGRADIENT:
                case XATTR_FILLHATCH:
                case XATTR_FILLSTYLE:
                case XATTR_FILLTRANSPARENCE:
                case XATTR_FILLFLOATTRANSPARENCE:
                case XATTR_SECONDARYFILLCOLOR:
                {
                    // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle
                    // itself, so decide what to do using the name
                    const bool bHeader(rPropName.EqualsAscii("Header", 0, 6));
                    const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6));

                    if(bHeader || bFooter)
                    {
                        const SvxSetItem* pSetItem = 0;

                        if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem))
                        {
                            // create a new SvxSetItem and get it's ItemSet as new target
                            SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone());
                            SfxItemSet& rSetSet = pNewSetItem->GetItemSet();

                            // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
                            rSetSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet());

                            // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the
                            // default method to set the property
                            SfxItemSet* pRememberItemSet = aBaseImpl.replaceItemSet(&rSetSet);
                            lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
                            aBaseImpl.replaceItemSet(pRememberItemSet);

                            // reset paret at ItemSet from SetItem
                            rSetSet.SetParent(0);

                            // set the new SvxSetItem at the real target and delete it
                            aBaseImpl.GetItemSet().Put(*pNewSetItem);
                            delete pNewSetItem;
                        }
                    }
                    else
                    {
                        // part of PageStyle, fallback to default
                        lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
                    }

                    break;
                }

                case FN_PARAM_FTN_INFO :
                {
                    const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
@@ -3642,45 +3812,58 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
                    delete pNewFtnItem;
                    if(!bPut)
                        throw lang::IllegalArgumentException();

                    break;
                }
                break;

                case  FN_UNO_HEADER       :
                case  FN_UNO_HEADER_LEFT  :
                case  FN_UNO_HEADER_RIGHT :
                case  FN_UNO_FOOTER       :
                case  FN_UNO_FOOTER_LEFT  :
                case  FN_UNO_FOOTER_RIGHT :
                {
                    throw lang::IllegalArgumentException();
                //break;
                    break;
                }

                default:
                    lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
                                        GetBasePool(), GetDoc(), GetFamily());
                {
                    //UUUU
                    lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
                    break;
                }
            }
        }
        else if(IsDescriptor())
        {
            if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp]))
            if(!GetPropImpl()->SetProperty(rPropName, pValues[nProp]))
                throw lang::IllegalArgumentException();
        }
        else
        {
            throw uno::RuntimeException();
        }
    }

    if(aBaseImpl.HasItemSet())
    {
        ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());

        if (undoGuard.UndoWasEnabled())
        {
            // Fix i64460: as long as Undo of page styles with header/footer causes trouble...
            GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
        }
        aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());

        aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet());
    }
}

void SwXPageStyle::setPropertyValues(
    const uno::Sequence< OUString >& rPropertyNames,
    const uno::Sequence< uno::Any >& rValues )
        throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());

@@ -3701,9 +3884,10 @@ void SwXPageStyle::setPropertyValues(
/* -----------------------------04.11.03 13:50--------------------------------

 ---------------------------------------------------------------------------*/
static uno::Reference<text::XText>
lcl_makeHeaderFooter(
    const sal_uInt16 nRes, const bool bHeader, SwFrmFmt const*const pFrmFmt)
static uno::Reference<text::XText> lcl_makeHeaderFooter(
    const sal_uInt16 nRes,
    const bool bHeader,
    SwFrmFmt const*const pFrmFmt)
{
    if (!pFrmFmt) { return 0; }

@@ -3725,8 +3909,8 @@ lcl_makeHeaderFooter(
}

uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
        const uno::Sequence< OUString >& rPropertyNames )
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
const uno::Sequence< OUString >& rPropertyNames )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    if(!GetDoc())
        throw uno::RuntimeException();
@@ -3734,17 +3918,21 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
    sal_Int32 nLength = rPropertyNames.getLength();
    const OUString* pNames = rPropertyNames.getConstArray();
    uno::Sequence< uno::Any > aRet ( nLength );

    uno::Any* pRet = aRet.getArray();
    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
    const SfxItemPropertyMap*   pMap = pPropSet->getPropertyMap();
    SwStyleBase_Impl aBase(*GetDoc(), GetStyleName());
    SwStyleBase_Impl aBase(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent
    SfxStyleSheetBase* pBase = 0;

    for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
    {
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] );
        const String& rPropName = pNames[nProp];
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName );

        if (!pEntry)
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
        {
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        }

        if(GetBasePool())
        {
@@ -3755,130 +3943,150 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
                pBase = GetBasePool()->Find(GetStyleName());
                GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
            }

            sal_uInt16 nRes = 0;
            bool bHeader = false;
            sal_Bool bAll = sal_False, bLeft = sal_False, bRight = sal_False;
            const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));

            switch(pEntry->nWID)
            {
                case FN_UNO_HEADER_ON:
                case FN_UNO_HEADER_BACKGROUND:
                case FN_UNO_HEADER_BOX:
                case FN_UNO_HEADER_LR_SPACE:
                case FN_UNO_HEADER_SHADOW:
                case FN_UNO_HEADER_BODY_DISTANCE:
                case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
                case FN_UNO_HEADER_SHARE_CONTENT:
                case FN_UNO_HEADER_HEIGHT:
                case FN_UNO_HEADER_EAT_SPACING:

                case FN_UNO_FOOTER_ON:
                case FN_UNO_FOOTER_BACKGROUND:
                case FN_UNO_FOOTER_BOX:
                case FN_UNO_FOOTER_LR_SPACE:
                case FN_UNO_FOOTER_SHADOW:
                case FN_UNO_FOOTER_BODY_DISTANCE:
                case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
                case FN_UNO_FOOTER_SHARE_CONTENT:
                case FN_UNO_FOOTER_HEIGHT:
                case FN_UNO_FOOTER_EAT_SPACING:
                case SID_ATTR_PAGE_ON:
                case RES_BACKGROUND:
                case RES_BOX:
                case RES_LR_SPACE:
                case RES_SHADOW:
                case RES_UL_SPACE:
                case SID_ATTR_PAGE_DYNAMIC:
                case SID_ATTR_PAGE_SHARED:
                case SID_ATTR_PAGE_SIZE:
                case RES_HEADER_FOOTER_EAT_SPACING:
                {
                    SfxStyleSheetBasePool* pBasePool2 = ((SwXPageStyle*)this)->GetBasePool();
                    pBasePool2->SetSearchMask(GetFamily());
                    SfxStyleSheetBase* pBase2 = pBasePool2->Find(GetStyleName());
                    if(pBase2)
                    // These slots are used for Header, Footer and (partially) for PageStyle directly.
                    // Check for Header/Footer entry
                    const bool bHeader(rPropName.EqualsAscii("Header", 0, 6));
                    const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6));

                    if(bHeader || bFooter)
                    {
                        // slot is a Header/Footer slot
                        rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
                        const SfxItemSet& rSet = xStyle->GetItemSet();
                        const SvxSetItem* pSetItem;

                        if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem))
                        {
                            // get from SfxItemSet of the corresponding SfxSetItem
                            const SfxItemSet& rSetSet = pSetItem->GetItemSet();
                            SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet));
                            pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                            aBase.replaceItemSet(pRememberItemSet);
                        }
                        else if(pEntry->nWID == SID_ATTR_PAGE_ON)
                        {
                            // header/footer is not available, thus off. Default is sal_False, though
                            sal_Bool bRet = sal_False;
                            pRet[nProp].setValue(&bRet, ::getCppuBooleanType());
                        }
                    }
                    else
                    {
                        switch(pEntry->nWID)
                        {
                            case SID_ATTR_PAGE_DYNAMIC:
                            case SID_ATTR_PAGE_SHARED:
                            case SID_ATTR_PAGE_ON:
                            case RES_HEADER_FOOTER_EAT_SPACING:
                            {
                                // these slots are exclusive to Header/Footer, thus this is an error
                                throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
                                break;
                            }
                            default:
                            {
                                // part of PageStyle, fallback to default
                                pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                            }
                        }
                    }

                    break;
                }

                case XATTR_FILLBMP_SIZELOG:
                case XATTR_FILLBMP_TILEOFFSETX:
                case XATTR_FILLBMP_TILEOFFSETY:
                case XATTR_FILLBMP_POSOFFSETX:
                case XATTR_FILLBMP_POSOFFSETY:
                case XATTR_FILLBMP_POS:
                case XATTR_FILLBMP_SIZEX:
                case XATTR_FILLBMP_SIZEY:
                case XATTR_FILLBMP_STRETCH:
                case XATTR_FILLBMP_TILE:
                case OWN_ATTR_FILLBMP_MODE:
                case XATTR_FILLCOLOR:
                case XATTR_FILLBACKGROUND:
                case XATTR_FILLBITMAP:
                case XATTR_GRADIENTSTEPCOUNT:
                case XATTR_FILLGRADIENT:
                case XATTR_FILLHATCH:
                case XATTR_FILLSTYLE:
                case XATTR_FILLTRANSPARENCE:
                case XATTR_FILLFLOATTRANSPARENCE:
                case XATTR_SECONDARYFILLCOLOR:
                {
                    // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle
                    // itself, so decide what to do using the name
                    const bool bHeader(rPropName.EqualsAscii("Header", 0, 6));
                    const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6));

                    if(bHeader || bFooter)
                    {
                        rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
                        const SfxItemSet& rSet = xStyle->GetItemSet();
                        sal_Bool bFooter = sal_False;
                        switch(pEntry->nWID)
                        {
                            case FN_UNO_FOOTER_ON:
                                bFooter = sal_True;
                            // kein break!
                            case FN_UNO_HEADER_ON:
                            {
                                //falls das SetItem nicht da ist, dann ist der Wert sal_False
                                sal_Bool bRet = sal_False;
                                pRet[nProp].setValue(&bRet, ::getCppuBooleanType());
                                nRes = SID_ATTR_PAGE_ON;
                            }
                            break;
                            case FN_UNO_FOOTER_BACKGROUND:      bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_BACKGROUND:      nRes = RES_BACKGROUND;
                            break;
                            case FN_UNO_FOOTER_BOX:             bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_BOX:             nRes = RES_BOX;
                            break;
                            case FN_UNO_FOOTER_LR_SPACE:        bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_LR_SPACE:        nRes = RES_LR_SPACE;
                            break;
                            case FN_UNO_FOOTER_SHADOW:          bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_SHADOW:          nRes = RES_SHADOW;
                            break;
                            case FN_UNO_FOOTER_BODY_DISTANCE:   bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_BODY_DISTANCE:   nRes = RES_UL_SPACE;
                            break;
                            case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
                            break;
                            case FN_UNO_FOOTER_SHARE_CONTENT:   bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_SHARE_CONTENT:   nRes = SID_ATTR_PAGE_SHARED;
                            break;
                            case FN_UNO_FOOTER_HEIGHT:          bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_HEIGHT:          nRes = SID_ATTR_PAGE_SIZE;
                            break;
                            case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True;
                            // kein break;
                            case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
                            break;
                        }
                        const SvxSetItem* pSetItem;
                        if(SFX_ITEM_SET == rSet.GetItemState(
                                bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
                                sal_False, (const SfxPoolItem**)&pSetItem))

                        if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem))
                        {
                            const SfxItemSet& rTmpSet = pSetItem->GetItemSet();
                            const SfxPoolItem* pItem = 0;
                            rTmpSet.GetItemState(nRes, sal_True, &pItem);
                            if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes))
                                pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes);
                            if(pItem)
                                pItem->QueryValue(pRet[nProp], pEntry->nMemberId);
                            // set at SfxItemSet of the corresponding SfxSetItem
                            const SfxItemSet& rSetSet = pSetItem->GetItemSet();
                            SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet));
                            pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                            aBase.replaceItemSet(pRememberItemSet);
                        }
                    }
                    else
                    {
                        // part of PageStyle, fallback to default
                        pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                    }

                    break;
                }
                break;
                case  FN_UNO_HEADER       :
                    bAll = sal_True; goto Header;
                case  FN_UNO_HEADER_LEFT  :
                    bLeft = sal_True; goto Header;
                case  FN_UNO_HEADER_RIGHT :
                    bRight = sal_True; goto Header;
Header:
                    bHeader = true;
                    nRes = RES_HEADER; goto MakeObject;
                case  FN_UNO_FOOTER       :
                    bAll = sal_True; goto Footer;
                case  FN_UNO_FOOTER_LEFT  :
                    bLeft = sal_True; goto Footer;
                case  FN_UNO_FOOTER_RIGHT :
                    bRight = sal_True;
Footer:
                    nRes = RES_FOOTER;
MakeObject:

                case FN_UNO_HEADER:
                case FN_UNO_HEADER_LEFT:
                case FN_UNO_HEADER_RIGHT:
                case FN_UNO_FOOTER:
                case FN_UNO_FOOTER_LEFT:
                case FN_UNO_FOOTER_RIGHT:
                {
                    //UUUU cleanups for readability (undos removed, rearranged)
                    bool bHeader(false);

                    switch(pEntry->nWID)
                    {
                        case FN_UNO_HEADER:       bHeader = true;  nRes = RES_HEADER; bAll = sal_True;   break;
                        case FN_UNO_HEADER_LEFT:  bHeader = true;  nRes = RES_HEADER; bLeft = sal_True;  break;
                        case FN_UNO_HEADER_RIGHT: bHeader = true;  nRes = RES_HEADER; bRight = sal_True; break;
                        case FN_UNO_FOOTER:       bHeader = false; nRes = RES_FOOTER; bAll = sal_True;   break;
                        case FN_UNO_FOOTER_LEFT:  bHeader = false; nRes = RES_FOOTER; bLeft = sal_True;  break;
                        case FN_UNO_FOOTER_RIGHT: bHeader = false; nRes = RES_FOOTER; bRight = sal_True; break;
                        default: break;
                    }

                    const SwPageDesc& rDesc = aBase.GetOldPageDesc();
                    const SwFrmFmt* pFrmFmt = 0;
                    sal_Bool bShare = (bHeader && rDesc.IsHeaderShared())||
                                    (!bHeader && rDesc.IsFooterShared());
                    sal_Bool bShare = (bHeader && rDesc.IsHeaderShared()) || (!bHeader && rDesc.IsFooterShared());
                    // TextLeft returns the left content if there is one,
                    // Text and TextRight return the master content.
                    // TextRight does the same as Text and is for
@@ -3897,32 +4105,47 @@ MakeObject:
                    {
                        pRet[nProp] <<= xRet;
                    }

                    break;
                }
                break;

                case FN_PARAM_FTN_INFO :
                {
                    rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
                    const SfxItemSet& rSet = xStyle->GetItemSet();
                    const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO);
                    rItem.QueryValue(pRet[nProp], pEntry->nMemberId);
                    rItem.QueryValue(pRet[nProp], nMemberId);
                    break;
                }
                break;

                default:
                pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                {
                    //UUUU
                    pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
                    break;
                }
            }
        }
        else if(IsDescriptor())
        {
            uno::Any* pAny = 0;
            GetPropImpl()->GetProperty(pNames[nProp], pAny);
            GetPropImpl()->GetProperty(rPropName, pAny);

            if ( !pAny )
                GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
            {
                GetPropImpl()->GetProperty ( rPropName, mxStyleData, pRet[ nProp ] );
            }
            else
            {
                pRet[nProp] = *pAny;
            }
        }
        else
        {
            throw uno::RuntimeException();
        }
    }

    return aRet;
}
/* -----------------------------18.04.01 13:50--------------------------------
@@ -3930,7 +4153,7 @@ MakeObject:
 ---------------------------------------------------------------------------*/
uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues(
    const uno::Sequence< OUString >& rPropertyNames )
        throw(uno::RuntimeException)
throw(uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    uno::Sequence< uno::Any > aValues;
@@ -3954,26 +4177,27 @@ uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues(
/*-- 17.12.98 08:43:36---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw(
    beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
uno::Any SwXPageStyle::getPropertyValue(
    const OUString& rPropertyName)
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    const uno::Sequence<OUString> aProperties(&rPropertyName, 1);

    return GetPropertyValues_Impl(aProperties).getConstArray()[0];
}
/*-- 17.12.98 08:43:36---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
    throw( beans::UnknownPropertyException,
        beans::PropertyVetoException,
        lang::IllegalArgumentException,
        lang::WrappedTargetException,
        uno::RuntimeException)
void SwXPageStyle::setPropertyValue(
    const OUString& rPropertyName,
    const uno::Any& rValue)
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    const uno::Sequence<uno::Any> aValues(&rValue, 1);

    SetPropertyValues_Impl( aProperties, aValues );
}

@@ -4171,57 +4395,220 @@ void SwXAutoStyleFamily::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe
  -----------------------------------------------------------------------*/
uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
    const uno::Sequence< beans::PropertyValue >& Values )
        throw (uno::RuntimeException)
throw (uno::RuntimeException)
{
    if( !pDocShell )
    {
        throw uno::RuntimeException();
    }

    const sal_uInt16* pRange = 0;
    const SfxItemPropertySet* pPropSet = 0;

    switch( eFamily )
    {
        case IStyleAccess::AUTO_STYLE_CHAR:
        {
            pRange = aCharAutoFmtSetRange;
            pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE);
            break;
        }
        break;
        case IStyleAccess::AUTO_STYLE_RUBY:
        {
            pRange = 0;//aTxtNodeSetRange;
            pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE);
            break;
        }
        break;
        case IStyleAccess::AUTO_STYLE_PARA:
        {
            pRange = aTxtNodeSetRange;
            pRange = aTxtNodeSetRange; //UUUU checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
            pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE);
            break;
        }
        break;

        default:
            ;
        default: break;
    }

    SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange );
    const beans::PropertyValue* pSeq = Values.getConstArray();
    sal_Int32 nLen = Values.getLength();
    for( sal_Int32 i = 0; i < nLen; ++i )
    const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == eFamily);

    if(!bTakeCareOfDrawingLayerFillStyle)
    {
        try
        for( sal_Int32 i = 0; i < nLen; ++i )
        {
            pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet );
        }
        catch (beans::UnknownPropertyException &)
        {
            ASSERT( false, "Unknown property" );
        }
        catch (lang::IllegalArgumentException &)
        {
            ASSERT( false, "Illegal argument" );
            try
            {
                pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet );
            }
            catch (beans::UnknownPropertyException &)
            {
                ASSERT( false, "Unknown property" );
            }
            catch (lang::IllegalArgumentException &)
            {
                ASSERT( false, "Illegal argument" );
            }
        }
    }
    else
    {
        //UUUU set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
        // to make cases in RES_BACKGROUND work correct; target *is* a style
        // where this is the case
        aSet.SetParent(&pDocShell->GetDoc()->GetDfltTxtFmtColl()->GetAttrSet());

        //UUUU here the used DrawingLayer FillStyles are imported when family is
        // equal to IStyleAccess::AUTO_STYLE_PARA, thus we will need to serve the
        // used slots functionality here to do this correctly
        const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();

        for( sal_Int32 i = 0; i < nLen; ++i )
        {
            const OUString& rPropName = pSeq[i].Name;
            uno::Any aValue(pSeq[i].Value);
            const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);

            if(!pEntry)
            {
                throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
            }

            const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
            bool bDone(false);

            // check for needed metric translation
            if(pEntry->nMemberId & SFX_METRIC_ITEM)
            {
                bool bDoIt(true);

                if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
                {
                    // exception: If these ItemTypes are used, do not convert when these are negative
                    // since this means they are intended as percent values
                    sal_Int32 nValue = 0;

                    if(aValue >>= nValue)
                    {
                        bDoIt = nValue > 0;
                    }
                }

                if(bDoIt)
                {
                    const SfxItemPool& rPool = pDocShell->GetDoc()->GetAttrPool();
                    const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));

                    if(eMapUnit != SFX_MAPUNIT_100TH_MM)
                    {
                        SvxUnoConvertFromMM(eMapUnit, aValue);
                    }
                }
            }

            switch(pEntry->nWID)
            {
                case XATTR_FILLGRADIENT:
                case XATTR_FILLHATCH:
                case XATTR_FILLBITMAP:
                case XATTR_FILLFLOATTRANSPARENCE:
                // not yet needed; activate when LineStyle support may be added
                // case XATTR_LINESTART:
                // case XATTR_LINEEND:
                // case XATTR_LINEDASH:
                {
                    if(MID_NAME == nMemberId)
                    {
                        //UUUU add set commands for FillName items
                        OUString aTempName;

                        if(!(aValue >>= aTempName))
                        {
                            throw lang::IllegalArgumentException();
                        }

                        SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
                        bDone = true;
                    }
                    else if(MID_GRAFURL == nMemberId)
                    {
                        if(XATTR_FILLBITMAP == pEntry->nWID)
                        {
                            //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
                            const Graphic aNullGraphic;
                            XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic);

                            aXFillBitmapItem.PutValue(aValue, nMemberId);
                            aSet.Put(aXFillBitmapItem);
                            bDone = true;
                        }
                    }

                    break;
                }
                case RES_BACKGROUND:
                {
                    //UUUU
                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND));
                    SvxBrushItem aChangedBrushItem(aOriginalBrushItem);

                    aChangedBrushItem.PutValue(aValue, nMemberId);

                    if(!(aChangedBrushItem == aOriginalBrushItem))
                    {
                        setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
                    }

                    bDone = true;
                    break;
                }
                case OWN_ATTR_FILLBMP_MODE:
                {
                    //UUUU
                    drawing::BitmapMode eMode;

                    if(!(aValue >>= eMode))
                    {
                        sal_Int32 nMode = 0;

                        if(!(aValue >>= nMode))
                        {
                            throw lang::IllegalArgumentException();
                        }

                        eMode = (drawing::BitmapMode)nMode;
                    }

                    aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
                    aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));

                    bDone = true;
                    break;
                }
                default: break;
            }

            if(!bDone)
            {
                pPropSet->setPropertyValue( rPropName, aValue, aSet );
            }
        }

        //UUUU clear parent again
        aSet.SetParent(0);
    }

    //UUUU need to ensure uniqueness of evtl. added NameOrIndex items
    // currently in principle only needed when bTakeCareOfDrawingLayerFillStyle,
    // but does not hurt and is easily forgotten later eventually, so keep it
    // as common case
    pDocShell->GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aSet);

    // AutomaticStyle creation
    SfxItemSet_Pointer_t pSet = pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, eFamily );
    uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(pDocShell->GetDoc(), pSet, eFamily);

    return xRet;
}
/*-- 31.05.2006 11:24:02---------------------------------------------------
@@ -4343,38 +4730,48 @@ uno::Any SwXAutoStylesEnumerator::nextElement(  )
    }
    return aRet;
}
/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam )
: pSet( pInitSet ), eFamily( eFam )
//////////////////////////////////////////////////////////////////////////////
//UUUU SwXAutoStyle with the family IStyleAccess::AUTO_STYLE_PARA (or
// PROPERTY_MAP_PARA_AUTO_STYLE) now uses DrawingLayer FillStyles to allow
// unified paragraph background fill, thus the UNO API implementation has to
// support the needed slots for these. This seems to be used only for reading
// (no setPropertyValue implementation here), so maybe specialized for saving
// the Writer Doc to ODF

SwXAutoStyle::SwXAutoStyle(
    SwDoc* pDoc,
    SfxItemSet_Pointer_t pInitSet,
    IStyleAccess::SwAutoStyleFamily eFam)
:   mpSet(pInitSet),
    meFamily(eFam),
    mrDoc(*pDoc)
{
    // Register ourselves as a listener to the document (via the page descriptor)
    pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    mrDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
SwXAutoStyle::~SwXAutoStyle()
{
}

void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
void SwXAutoStyle::Modify(
    const SfxPoolItem* pOld,
    const SfxPoolItem *pNew)
{
    ClientModify(this, pOld, pNew);

    if(!GetRegisteredIn())
        pSet.reset();
    {
        mpSet.reset();
    }
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo(  )
                throw (uno::RuntimeException)
uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo()
throw (uno::RuntimeException)
{
    uno::Reference< beans::XPropertySetInfo >  xRet;
    switch( eFamily )
    switch( meFamily )
    {
        case IStyleAccess::AUTO_STYLE_CHAR:
        {
@@ -4416,140 +4813,202 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo(  )
    return xRet;
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
     throw( beans::UnknownPropertyException,
            beans::PropertyVetoException,
            lang::IllegalArgumentException,
            lang::WrappedTargetException,
            uno::RuntimeException)
void SwXAutoStyle::setPropertyValue(
    const OUString& /*rPropertyName*/,
    const uno::Any& /*rValue*/ )
throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException )
uno::Any SwXAutoStyle::getPropertyValue(
    const OUString& rPropertyName )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    const uno::Sequence<OUString> aProperties(&rPropertyName, 1);

    return GetPropertyValues_Impl(aProperties).getConstArray()[0];
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/,
                                              const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException )
void SwXAutoStyle::addPropertyChangeListener(
    const OUString& /*aPropertyName*/,
    const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/,
                                                 const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException )
void SwXAutoStyle::removePropertyChangeListener(
    const OUString& /*aPropertyName*/,
    const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::addVetoableChangeListener( const OUString& /*PropertyName*/,
                                              const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException )
void SwXAutoStyle::addVetoableChangeListener(
    const OUString& /*PropertyName*/,
    const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/,
                                                 const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException )
void SwXAutoStyle::removeVetoableChangeListener(
    const OUString& /*PropertyName*/,
    const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::setPropertyValues(
        const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
        const uno::Sequence< uno::Any >& /*aValues*/ )
            throw (beans::PropertyVetoException, lang::IllegalArgumentException,
                lang::WrappedTargetException, uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
    const uno::Sequence< uno::Any >& /*aValues*/ )
throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
        const uno::Sequence< OUString > & rPropertyNames )
    throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    const uno::Sequence< OUString > & rPropertyNames )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
    if( !pSet.get() )
    if( !mpSet.get() )
    {
        throw uno::RuntimeException();
    // query_item
    }

    // query_item
    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
    switch(eFamily)

    switch(meFamily)
    {
        case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
        default:
            ;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
    const OUString* pNames = rPropertyNames.getConstArray();

    sal_Int32 nLen = rPropertyNames.getLength();
    const sal_Int32 nLen(rPropertyNames.getLength());
    uno::Sequence< uno::Any > aRet( nLen );
    uno::Any* pValues = aRet.getArray();

    SfxItemSet& rSet = *pSet.get();
    const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily);

    for( sal_Int32 i = 0; i < nLen; ++i )
    {
        const String& rPropName = pNames[i];
        const OUString& rPropName = pNames[i];
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);

        if(!pEntry)
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID )
        {
            OUString sName(StylePool::nameOf( pSet ));
            pValues[i] <<= sName;
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        }
        else
            pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] );

        uno::Any aTarget;
        bool bDone(false);

        if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID )
        {
            OUString sName(StylePool::nameOf( mpSet ));
            aTarget <<= sName;
            bDone = true;
        }
        else if(bTakeCareOfDrawingLayerFillStyle)
        {
            //UUUU add support for DrawingLayer FillStyle slots
            switch(pEntry->nWID)
            {
                case RES_BACKGROUND:
                {
                    const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
                    const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));

                    if(!aOriginalBrushItem.QueryValue(aTarget, nMemberId))
                    {
                        OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
                    }

                    bDone = true;
                    break;
                }
                case OWN_ATTR_FILLBMP_MODE:
                {
                    const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&mpSet->Get(XATTR_FILLBMP_STRETCH));
                    const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&mpSet->Get(XATTR_FILLBMP_TILE));

                    if( pTileItem && pTileItem->GetValue() )
                    {
                        aTarget <<= drawing::BitmapMode_REPEAT;
                    }
                    else if( pStretchItem && pStretchItem->GetValue() )
                    {
                        aTarget <<= drawing::BitmapMode_STRETCH;
                    }
                    else
                    {
                        aTarget <<= drawing::BitmapMode_NO_REPEAT;
                    }

                    bDone = true;
                    break;
                }
            }
        }

        if(!bDone)
        {
            pPropSet->getPropertyValue( *pEntry, *mpSet, aTarget );
        }

        if(bTakeCareOfDrawingLayerFillStyle)
        {
            if(pEntry->pType && *(pEntry->pType) == ::getCppuType((const sal_Int16*)0) && *(pEntry->pType) != aTarget.getValueType())
            {
                // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
                sal_Int32 nValue = 0;
                aTarget >>= nValue;
                aTarget <<= (sal_Int16)nValue;
            }

            // check for needed metric translation
            if(pEntry->nMemberId & SFX_METRIC_ITEM)
            {
                bool bDoIt(true);

                if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
                {
                    // exception: If these ItemTypes are used, do not convert when these are negative
                    // since this means they are intended as percent values
                    sal_Int32 nValue = 0;

                    if(aTarget >>= nValue)
                    {
                        bDoIt = nValue > 0;
                    }
                }

                if(bDoIt)
                {
                    const SfxItemPool& rPool = mrDoc.GetAttrPool();
                    const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));

                    if(eMapUnit != SFX_MAPUNIT_100TH_MM)
                    {
                        SvxUnoConvertToMM(eMapUnit, aTarget);
                    }
                }
            }
        }

        // add value
        pValues[i] = aTarget;
    }

    return aRet;
}

/*-- 19.05.2006 11:24:09---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
        const uno::Sequence< ::rtl::OUString >& rPropertyNames )
            throw (uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& rPropertyNames )
throw (uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());
    uno::Sequence< uno::Any > aValues;
@@ -4571,41 +5030,29 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
    return aValues;
}

/*-- 19.05.2006 11:24:10---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::addPropertiesChangeListener(
        const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
        const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
            throw (uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
throw (uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:10---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::removePropertiesChangeListener(
        const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
            throw (uno::RuntimeException)
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
throw (uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:11---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::firePropertiesChangeEvent(
        const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
        const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
            throw (uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/,
    const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
throw (uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:11---------------------------------------------------

  -----------------------------------------------------------------------*/
beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyName )
    throw( beans::UnknownPropertyException,
           uno::RuntimeException)
beans::PropertyState SwXAutoStyle::getPropertyState(
    const OUString& rPropertyName )
throw( beans::UnknownPropertyException, uno::RuntimeException)
{
    vos::OGuard aGuard(Application::GetSolarMutex());

@@ -4616,106 +5063,179 @@ beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyNa
    return aStates.getConstArray()[0];
}

/*-- 19.05.2006 11:24:11---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::setPropertyToDefault( const OUString& /*PropertyName*/ )
    throw( beans::UnknownPropertyException,
           uno::RuntimeException )
void SwXAutoStyle::setPropertyToDefault(
    const OUString& /*PropertyName*/ )
throw( beans::UnknownPropertyException, uno::RuntimeException )
{
}

/*-- 19.05.2006 11:24:11---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName )
    throw( beans::UnknownPropertyException,
           lang::WrappedTargetException,
           uno::RuntimeException)
uno::Any SwXAutoStyle::getPropertyDefault(
    const OUString& rPropertyName )
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
    const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );

    return getPropertyDefaults ( aSequence ).getConstArray()[0];
}

/*-- 19.05.2006 11:24:12---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates(
        const uno::Sequence< ::rtl::OUString >& rPropertyNames )
            throw (beans::UnknownPropertyException, uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& rPropertyNames )
throw (beans::UnknownPropertyException, uno::RuntimeException)
{
    if( !pSet.get() )
    if( !mpSet.get() )
    {
        throw uno::RuntimeException();
    }

    vos::OGuard aGuard(Application::GetSolarMutex());
    uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
    beans::PropertyState* pStates = aRet.getArray();
    const OUString* pNames = rPropertyNames.getConstArray();

    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
    switch(eFamily)

    switch(meFamily)
    {
        case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
        default:
            ;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();
    SfxItemSet& rSet = *pSet.get();
    const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily);

    for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
    {
        const String& rPropName = pNames[i];
        const OUString& rPropName = pNames[i];
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);

        if(!pEntry)
        {
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        pStates[i] = pPropSet->getPropertyState(*pEntry, rSet );
        }

        bool bDone(false);

        if(bTakeCareOfDrawingLayerFillStyle)
        {
            //UUUU DrawingLayer PropertyStyle support
            switch(pEntry->nWID)
            {
                case OWN_ATTR_FILLBMP_MODE:
                {
                    if(SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_STRETCH, false)
                        || SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_TILE, false))
                    {
                        pStates[i] = beans::PropertyState_DIRECT_VALUE;
                    }
                    else
                    {
                        pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
                    }

                    bDone = true;
                    break;
                }
                case RES_BACKGROUND:
                {
                    if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*mpSet))
                    {
                        pStates[i] = beans::PropertyState_DIRECT_VALUE;
                        bDone = true;
                    }

                    break;
                }
            }
        }

        if(!bDone)
        {
            pStates[i] = pPropSet->getPropertyState(*pEntry, *mpSet );
        }
    }

    return aRet;
}

/*-- 19.05.2006 11:24:12---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::setAllPropertiesToDefault(  )
            throw (uno::RuntimeException)
throw (uno::RuntimeException)
{
}

/*-- 19.05.2006 11:24:13---------------------------------------------------

  -----------------------------------------------------------------------*/
void SwXAutoStyle::setPropertiesToDefault(
        const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ )
            throw (beans::UnknownPropertyException, uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& rPropertyNames )
throw (beans::UnknownPropertyException, uno::RuntimeException)
{
    if( !mpSet.get() )
    {
        throw uno::RuntimeException();
    }

    const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily);

    if(!bTakeCareOfDrawingLayerFillStyle)
    {
        return;
    }

    //UUUU support DrawingLayer FillStyle slots from here on
    vos::OGuard aGuard(Application::GetSolarMutex());
    const OUString* pNames = rPropertyNames.getConstArray();
    sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;

    switch(meFamily)
    {
        case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
        default: ;
    }

    const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap();

    for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
    {
        const OUString& rPropName = pNames[i];
        const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName);

        if(!pEntry)
        {
            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
        }

        switch(pEntry->nWID)
        {
            case OWN_ATTR_FILLBMP_MODE:
            {
                mpSet->ClearItem(XATTR_FILLBMP_STRETCH);
                mpSet->ClearItem(XATTR_FILLBMP_TILE);
            }
        }
    }
}

/*-- 19.05.2006 11:24:14---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults(
        const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ )
            throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                    uno::RuntimeException)
    const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
    uno::Sequence< uno::Any > aRet(0);

    return aRet;
}

/*-- 19.05.2006 11:24:14---------------------------------------------------

  -----------------------------------------------------------------------*/
uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException)
uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
throw (uno::RuntimeException)
{
    if( !pSet.get() )
    if( !mpSet.get() )
        throw uno::RuntimeException();
    vos::OGuard aGuard(Application::GetSolarMutex());
    std::vector< beans::PropertyValue > aPropertyVector;

    sal_Int8 nPropSetId = 0;
    switch(eFamily)
    switch(meFamily)
    {
        case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
        case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
@@ -4744,7 +5264,7 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::
//        ++aIt;
//    }

    SfxItemSet& rSet = *pSet.get();
    SfxItemSet& rSet = *mpSet.get();
    SfxItemIter aIter(rSet);
    const SfxPoolItem* pItem = aIter.FirstItem();

@@ -4802,3 +5322,6 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::

    return aRet;
}

//////////////////////////////////////////////////////////////////////////////
//eof
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index de2d047..8225d86 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -54,6 +54,10 @@
#include <numrule.hxx>
#include <swundo.hxx>

//UUUU
#include <svx/svdmodel.hxx>
#include <svx/drawitem.hxx>

#include "view.hxx"
#include "wrtsh.hxx"
#include "docsh.hxx"
@@ -509,10 +513,6 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
    Beschreibung:   Edit
 --------------------------------------------------------------------*/

//UUUU
//#include <svx/svdmodel.hxx>
//#include <svx/drawitem.hxx>

sal_uInt16 SwDocShell::Edit(
    const String &rName,
    const String &rParent,
@@ -668,22 +668,22 @@ sal_uInt16 SwDocShell::Edit(
            rSet.Put( aTmpBrush );
        }
    }

    if(SFX_STYLE_FAMILY_PAGE == nFamily || SFX_STYLE_FAMILY_PARA == nFamily)
    {
        //UUUU create needed items for XPropertyList entries from the DrawModel so that
        // the Area TabPage can access them
        SfxItemSet& rSet = xTmp->GetItemSet();
        const SdrModel* pDrawModel = GetDoc()->GetDrawModel();

        rSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
        rSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
        rSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST));
        rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST));
    }

    if (!bBasic)
    {
        //UUUU
        //if(SFX_STYLE_FAMILY_FRAME == nFamily)
        //{
        //    //UUUU create needed items for XPropertyList entries from the DrawModel so that
        //    // the Area TabPage can access them
        //    SfxItemSet& rSet = xTmp->GetItemSet();
        //    const SdrModel* pDrawModel = GetDoc()->GetDrawModel();
        //
        //    rSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
        //    rSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
        //    rSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST));
        //    rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST));
        //}

        // vor dem Dialog wird der HtmlMode an der DocShell versenkt
        sal_uInt16 nHtmlMode = ::GetHtmlMode(this);

@@ -752,13 +752,6 @@ sal_uInt16 SwDocShell::Edit(
                    aTmpSet.ClearItem( RES_BACKGROUND );
                }

                //UUUU
                if(bNew && SFX_STYLE_FAMILY_FRAME == nFamily)
                {
                    // clear FillStyle so that it works as a derived attribute
                    aTmpSet.ClearItem(XATTR_FILLSTYLE);
                }

                xTmp->SetItemSet( aTmpSet );

                if( SFX_STYLE_FAMILY_PAGE == nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
@@ -768,6 +761,20 @@ sal_uInt16 SwDocShell::Edit(
                        SwChartHelper::DoUpdateAllCharts( pDoc );
                }
            }

            //UUUU
            if(bNew)
            {
                if(SFX_STYLE_FAMILY_FRAME == nFamily || SFX_STYLE_FAMILY_PARA == nFamily)
                {
                    // clear FillStyle so that it works as a derived attribute
                    SfxItemSet aTmpSet(*pDlg->GetOutputItemSet());

                    aTmpSet.ClearItem(XATTR_FILLSTYLE);
                    xTmp->SetItemSet(aTmpSet);
                }
            }

            if(SFX_STYLE_FAMILY_PAGE == nFamily)
                pView->InvalidateRulerPos();

diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 204c7db..5ea6db5 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -64,6 +64,12 @@
#include <svx/svxids.hrc>
#include <SwRewriter.hxx>

//UUUU
#include <svx/xfillit0.hxx>
#include <svx/xflftrit.hxx>
#include <svx/svdmodel.hxx>
#include <svx/drawitem.hxx>

// MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als
// erstes Zeichen die Familie:

@@ -661,6 +667,11 @@ String  SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
        sal_Bool bHasCJKFontPrefix = sal_False;
        SvtCJKOptions aCJKOptions;

        //UUUU Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem
        // to decide if gradient transparence is used
        const XFillStyle eFillStyle(static_cast< const XFillStyleItem& >(pSet->Get(XATTR_FILLSTYLE)).GetValue());
        const bool bUseFloatTransparence(static_cast< const XFillFloatTransparenceItem& >(pSet->Get(XATTR_FILLFLOATTRANSPARENCE)).IsEnabled());

        while ( pItem )
        {
            if(!IsInvalidItem(pItem))
@@ -687,6 +698,44 @@ String  SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
                            sal_Bool bIsDefault = sal_False;
                            switch ( pItem->Which() )
                            {
                                //UUUU
                                case XATTR_FILLCOLOR:
                                {
                                    // only use active FillStyle information
                                    bIsDefault = (XFILL_SOLID == eFillStyle);
                                    break;
                                }
                                case XATTR_FILLGRADIENT:
                                {
                                    // only use active FillStyle information
                                    bIsDefault = (XFILL_GRADIENT == eFillStyle);
                                    break;
                                }
                                case XATTR_FILLHATCH:
                                {
                                    // only use active FillStyle information
                                    bIsDefault = (XFILL_HATCH == eFillStyle);
                                    break;
                                }
                                case XATTR_FILLBITMAP:
                                {
                                    // only use active FillStyle information
                                    bIsDefault = (XFILL_BITMAP == eFillStyle);
                                    break;
                                }
                                case XATTR_FILLTRANSPARENCE:
                                {
                                    // only active when not FloatTransparence
                                    bIsDefault = !bUseFloatTransparence;
                                    break;
                                }
                                case XATTR_FILLFLOATTRANSPARENCE:
                                {
                                    // only active when FloatTransparence
                                    bIsDefault = bUseFloatTransparence;
                                    break;
                                }

                                case SID_ATTR_PARA_PAGENUM:
                                    sPageNum = aItemPresentation;
                                    break;
@@ -1021,10 +1070,6 @@ sal_Bool   SwDocStyleSheet::SetFollow( const String& rStr)
    Beschreibung:   ueber Name und Family, Mask den ItemSet rausholen
 --------------------------------------------------------------------*/

//UUUU
#include <svx/svdmodel.hxx>
#include <svx/drawitem.hxx>

SfxItemSet&   SwDocStyleSheet::GetItemSet()
{
    if(!bPhysical)
@@ -1082,6 +1127,12 @@ SfxItemSet&   SwDocStyleSheet::GetItemSet()

        case SFX_STYLE_FAMILY_PAGE :
            {
                //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
                if(!aCoreSet.GetParent())
                {
                    aCoreSet.SetParent(&rDoc.GetDfltFrmFmt()->GetAttrSet());
                }

                ASSERT(pDesc, "Kein PageDescriptor");
                ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet);
            }
diff --git a/sw/source/ui/chrdlg/paradlg.src b/sw/source/ui/chrdlg/paradlg.src
index fa7f710..b71c2fa 100644
--- a/sw/source/ui/chrdlg/paradlg.src
+++ b/sw/source/ui/chrdlg/paradlg.src
@@ -24,6 +24,8 @@
#include "globals.hrc"
#include "chrdlg.hrc"
#include "paradlg.hrc"
#include <svx/dialogs.hrc>

#define HelpText "error - hier keine HelpTexte HelpText"
 // #define DLG_PARA 256
TabDialog DLG_PARA
@@ -85,12 +87,28 @@ TabDialog DLG_PARA
                Text [ en-US ] = "Borders" ;
                PageResID = TP_BORDER ;
            };

            //UUUU new Area and Transparence TabPages
            PageItem
            {
                Identifier = TP_BACKGROUND ;
                Text [ en-US ] = "Background" ;
                PageResID = TP_BACKGROUND ;
                Identifier = RID_SVXPAGE_AREA;
                PageResID = RID_SVXPAGE_AREA;
                Text [ en-US ] = "Area" ;
            };
            PageItem
            {
                Identifier = RID_SVXPAGE_TRANSPARENCE;
                PageResID = RID_SVXPAGE_TRANSPARENCE;
                Text [ en-US ] = "Transparency" ;
            };

            //UUUU Remove?
            //PageItem
            //{
            //    Identifier = TP_BACKGROUND ;
            //    Text [ en-US ] = "Background" ;
            //    PageResID = TP_BACKGROUND ;
            //};
        };
    };
};
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 8f548fb..3836f495 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -150,13 +150,20 @@ SwParaDlg::SwParaDlg(Window *pParent,
        }
        if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
        {
            DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
            //UUUU remove?
            //DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            //DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );

            //UUUU add Area and Transparence TabPages
            AddTabPage(RID_SVXPAGE_AREA);
            AddTabPage(RID_SVXPAGE_TRANSPARENCE);
        }
        else
        {
            RemoveTabPage(TP_BACKGROUND);
            //UUUU RemoveTabPage(TP_BACKGROUND);
            RemoveTabPage(RID_SVXPAGE_AREA);
            RemoveTabPage(RID_SVXPAGE_TRANSPARENCE);
        }
        if(!bHtmlMode || (nHtmlMode & HTMLMODE_PARA_BORDER))
        {
@@ -178,88 +185,123 @@ __EXPORT SwParaDlg::~SwParaDlg()
}


void __EXPORT SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
void __EXPORT SwParaDlg::PageCreated(sal_uInt16 nId,SfxTabPage& rPage)
{
    SwWrtShell& rSh = rView.GetWrtShell();
    SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));

    // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden
    if (nId == TP_BORDER)
    switch(nId)
    {
        aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
        rPage.PageCreated(aSet);
    }
    else if( nId == TP_PARA_STD )
    {
        aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
                            static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));

        if (!bDrawParaDlg)
        case TP_BORDER:
        {
            aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
            aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));

        }
        rPage.PageCreated(aSet);
    }
    else if( TP_PARA_ALIGN == nId)
    {
        if (!bDrawParaDlg)
        {
            aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
            // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden
            aSet.Put(SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
            rPage.PageCreated(aSet);
            break;
        }
    }
    else if( TP_PARA_EXT == nId )
    {
        // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
        // einer Tabelle steht
        const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
        if( !(FRMTYPE_BODY & eType) ||
            rSh.GetSelectionType() & nsSelectionType::SEL_TBL )
        case TP_PARA_STD:
        {
            aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
            rPage.PageCreated(aSet);
        }
    }
    else if( TP_DROPCAPS == nId )
    {
        ((SwDropCapsPage&)rPage).SetFormat(sal_False);
    }
    else if( TP_BACKGROUND == nId )
    {
      if(!( nHtmlMode & HTMLMODE_ON ) ||
        nHtmlMode & HTMLMODE_SOME_STYLES)
        {
            aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
            rPage.PageCreated(aSet);
        }
    }
    else if( TP_NUMPARA == nId)
    {
        //-->#outline level,added by zhaojianwei
        SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
        if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
        {
            ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
        }//<-end
            aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
                static_cast<sal_uInt16>(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width())));

        ((SwParagraphNumTabPage&)rPage).EnableNewStart();
        ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
        SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
        pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
        const SfxStyleSheetBase* pBase = pPool->First();
        SvStringsSortDtor aNames;
        while(pBase)
        {
            aNames.Insert(new String(pBase->GetName()));
            pBase = pPool->Next();
        }
        for(sal_uInt16 i = 0; i < aNames.Count(); i++)
            rBox.InsertEntry(*aNames.GetObject(i));
    }
            if(!bDrawParaDlg)
            {
                aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
                aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50 / 10));

            }
            rPage.PageCreated(aSet);
            break;
        }
        case TP_PARA_ALIGN:
        {
            if(!bDrawParaDlg)
            {
                aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
                rPage.PageCreated(aSet);
            }
            break;
        }
        case TP_PARA_EXT:
        {
            // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
            // einer Tabelle steht
            const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
            if(!(FRMTYPE_BODY & eType) ||
                rSh.GetSelectionType() & nsSelectionType::SEL_TBL)
            {
                aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
                rPage.PageCreated(aSet);
            }
            break;
        }
        case TP_DROPCAPS:
        {
            ((SwDropCapsPage&)rPage).SetFormat(sal_False);
            break;
        }
        case TP_BACKGROUND:
        {
            if(!(nHtmlMode & HTMLMODE_ON) ||
                nHtmlMode & HTMLMODE_SOME_STYLES)
            {
                aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,SVX_SHOW_SELECTOR));
                rPage.PageCreated(aSet);
            }
            break;
        }
        case TP_NUMPARA:
        {
            //-->#outline level,added by zhaojianwei
            SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
            if(pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle())
            {
                ((SwParagraphNumTabPage&)rPage).DisableOutline();
            }//<-end

            ((SwParagraphNumTabPage&)rPage).EnableNewStart();
            ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
            SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
            pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO,SFXSTYLEBIT_ALL);
            const SfxStyleSheetBase* pBase = pPool->First();
            SvStringsSortDtor aNames;
            while(pBase)
            {
                aNames.Insert(new String(pBase->GetName()));
                pBase = pPool->Next();
            }
            for(sal_uInt16 i = 0; i < aNames.Count(); i++)
                rBox.InsertEntry(*aNames.GetObject(i));
            break;
        }

        //UUUU inits for Area and Transparency TabPages
        // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
        // the color table) need to be added as items (e.g. SvxColorTableItem) to make
        // these pages find the needed attributes for fill style suggestions.
        // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
        // demand, but could also be directly added from the DrawModel.
        case RID_SVXPAGE_AREA:
        {
            SfxItemSet aNew(*aSet.GetPool(),
                SID_COLOR_TABLE, SID_BITMAP_LIST,
                SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);

            aNew.Put(*GetInputSetImpl());

            // add flag for direct graphic content selection
            aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));

            rPage.PageCreated(aNew);
            break;
        }

        case RID_SVXPAGE_TRANSPARENCE:
        {
            rPage.PageCreated(*GetInputSetImpl());
            break;
        }
    }
}



// eof
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index b699e78..d730a5c 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -199,9 +199,15 @@ SwTemplateDlg::SwTemplateDlg(Window*            pParent,
                                    SwParagraphNumTabPage::GetRanges);
            AddTabPage(TP_DROPCAPS,     SwDropCapsPage::Create,
                                        SwDropCapsPage::GetRanges );
            DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
            //UUUU remove?
            //DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            //DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );

            //UUUU add Area and Transparence TabPages
            AddTabPage(RID_SVXPAGE_AREA);
            AddTabPage(RID_SVXPAGE_TRANSPARENCE);

            DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
            DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
            AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
@@ -248,8 +254,10 @@ SwTemplateDlg::SwTemplateDlg(Window*            pParent,
                                        SwFrmAddPage::GetRanges );
            AddTabPage(TP_FRM_WRAP,     SwWrapTabPage::Create,
                                        SwWrapTabPage::GetRanges );
            DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");

            //UUUU remove?
            //DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            //DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");

            //UUUU remove?
            //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
@@ -272,9 +280,15 @@ SwTemplateDlg::SwTemplateDlg(Window*            pParent,
        // Seitenvorlagen
        case SFX_STYLE_FAMILY_PAGE:
        {
            DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
            //UUUU remove?
            //DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
            //DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
            //AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );

            //UUUU add Area and Transparence TabPages
            AddTabPage(RID_SVXPAGE_AREA);
            AddTabPage(RID_SVXPAGE_TRANSPARENCE);

            AddTabPage(TP_HEADER_PAGE,      String(SW_RES(STR_PAGE_HEADER)),
                                            SvxHeaderPage::Create,
                                            SvxHeaderPage::GetRanges );
@@ -401,247 +415,297 @@ const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
    Beschreibung:
 --------------------------------------------------------------------*/

void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
void SwTemplateDlg::PageCreated(sal_uInt16 nId,SfxTabPage &rPage)
{
    //Namen der Vorlagen und Metric setzen
    String sNumCharFmt, sBulletCharFmt;
    SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
    SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
    String sNumCharFmt,sBulletCharFmt;
    SwStyleNameMapper::FillUIName(RES_POOLCHR_NUM_LEVEL,sNumCharFmt);
    SwStyleNameMapper::FillUIName(RES_POOLCHR_BUL_LEVEL,sBulletCharFmt);
    SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));

    switch( nId )
    switch(nId)
    {
        case TP_CHAR_STD:
            {
                ASSERT(::GetActiveView(), "keine View aktiv");
        {
            ASSERT(::GetActiveView(),"keine View aktiv");

                SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
                    GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
            SvxFontListItem aFontListItem(*((SvxFontListItem*)::GetActiveView()->
                GetDocShell()->GetItem(SID_ATTR_CHAR_FONTLIST)));

                aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
                sal_uInt32 nFlags = 0;
                if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
                    nFlags = SVX_RELATIVE_MODE;
                if( SFX_STYLE_FAMILY_CHAR == nType )
                    nFlags = nFlags|SVX_PREVIEW_CHARACTER;
                aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
                rPage.PageCreated(aSet);
            }
            aSet.Put(SvxFontListItem(aFontListItem.GetFontList(),SID_ATTR_CHAR_FONTLIST));
            sal_uInt32 nFlags = 0;
            if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON))
                nFlags = SVX_RELATIVE_MODE;
            if(SFX_STYLE_FAMILY_CHAR == nType)
                nFlags = nFlags | SVX_PREVIEW_CHARACTER;
            aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,nFlags));
            rPage.PageCreated(aSet);
            break;
        }

        case TP_CHAR_EXT:
            {
        {
            sal_uInt32 nFlags = SVX_ENABLE_FLASH;
            if( SFX_STYLE_FAMILY_CHAR == nType )
                nFlags = nFlags|SVX_PREVIEW_CHARACTER;
            aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
            if(SFX_STYLE_FAMILY_CHAR == nType)
                nFlags = nFlags | SVX_PREVIEW_CHARACTER;
            aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,nFlags));
            rPage.PageCreated(aSet);
            }
            break;
        }

        case TP_CHAR_POS:
            if( SFX_STYLE_FAMILY_CHAR == nType )
        {
            if(SFX_STYLE_FAMILY_CHAR == nType)
            {
                aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
                aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
                rPage.PageCreated(aSet);
            }
        break;
            break;
        }

        case TP_CHAR_TWOLN:
            if( SFX_STYLE_FAMILY_CHAR == nType )
        {
            if(SFX_STYLE_FAMILY_CHAR == nType)
            {
                aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
                aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
                rPage.PageCreated(aSet);
            }
        break;
            break;
        }

        case TP_PARA_STD:
        {
            if(rPage.GetItemSet().GetParent())
            {
                if( rPage.GetItemSet().GetParent() )
                {
                    aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
                    aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
                    rPage.PageCreated(aSet);
                }

            }
            break;
        case TP_NUMPARA:
            {
                //-->#outlinelevel added by zhaojianwei
                //  handle if the current paragraph style is assigned to a list level of outline style,
                SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
                if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
                {
                    ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
                    ((SwParagraphNumTabPage&)rPage).DisableNumbering();
                }//<-end
                ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
                SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
                pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
                const SfxStyleSheetBase* pBase = pPool->First();
                SvStringsSortDtor aNames;
                while(pBase)
                {
                    aNames.Insert(new String(pBase->GetName()));
                    pBase = pPool->Next();
                }
                for(sal_uInt16 i = 0; i < aNames.Count(); i++)
                    rBox.InsertEntry(*aNames.GetObject(i));
        }
        break;
        case TP_PARA_ALIGN:
            {
                aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
                aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50 / 10));
                aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
                rPage.PageCreated(aSet);
            }

            break;
        }

        case TP_NUMPARA:
        {
            //-->#outlinelevel added by zhaojianwei
            //  handle if the current paragraph style is assigned to a list level of outline style,
            SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName(GetStyleSheet().GetName());
            if(pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle())
            {
                ((SwParagraphNumTabPage&)rPage).DisableOutline();
                ((SwParagraphNumTabPage&)rPage).DisableNumbering();
            }//<-end
            ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
            SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
            pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO,SFXSTYLEBIT_ALL);
            const SfxStyleSheetBase* pBase = pPool->First();
            SvStringsSortDtor aNames;
            while(pBase)
            {
                aNames.Insert(new String(pBase->GetName()));
                pBase = pPool->Next();
            }
            for(sal_uInt16 i = 0; i < aNames.Count(); i++)
                rBox.InsertEntry(*aNames.GetObject(i));
            break;
        }

        case TP_PARA_ALIGN:
        {
            aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
            rPage.PageCreated(aSet);
            break;
        }

        case TP_FRM_STD:
            ((SwFrmPage&)rPage).SetNewFrame( sal_True );
            ((SwFrmPage&)rPage).SetFormatUsed( sal_True );
        {
            ((SwFrmPage&)rPage).SetNewFrame(sal_True);
            ((SwFrmPage&)rPage).SetFormatUsed(sal_True);
            break;
        }

        case TP_FRM_ADD:
        {
            ((SwFrmAddPage&)rPage).SetFormatUsed(sal_True);
            ((SwFrmAddPage&)rPage).SetNewFrame(sal_True);
            break;
        }

        case TP_FRM_WRAP:
            ((SwWrapTabPage&)rPage).SetFormatUsed( sal_True, sal_False );
        {
            ((SwWrapTabPage&)rPage).SetFormatUsed(sal_True,sal_False);
            break;
        }

        case TP_COLUMN:
            if( nType == SFX_STYLE_FAMILY_FRAME )
        {
            if(nType == SFX_STYLE_FAMILY_FRAME)
                ((SwColumnPage&)rPage).SetFrmMode(sal_True);
            ((SwColumnPage&)rPage).SetFormatUsed( sal_True );
            ((SwColumnPage&)rPage).SetFormatUsed(sal_True);
            break;
        }

        //UUUU do not remove; many other style dialog combinations still use the SfxTabPage
        // for the SvxBrushItem (see RID_SVXPAGE_BACKGROUND)
        case TP_BACKGROUND:
        {
            sal_Int32 nFlagType = 0;
            if( SFX_STYLE_FAMILY_PARA == nType )
            if(SFX_STYLE_FAMILY_PARA == nType)
                nFlagType |= SVX_SHOW_PARACTL;
            if( SFX_STYLE_FAMILY_CHAR != nType )
            if(SFX_STYLE_FAMILY_CHAR != nType)
                nFlagType |= SVX_SHOW_SELECTOR;
            if( SFX_STYLE_FAMILY_FRAME == nType )
            if(SFX_STYLE_FAMILY_FRAME == nType)
                nFlagType |= SVX_ENABLE_TRANSPARENCY;
            aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
            aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,nFlagType));
            rPage.PageCreated(aSet);
        }
        break;
        case TP_CONDCOLL:
            ((SwCondCollPage&)rPage).SetCollection(
                ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
            break;
        }

        case TP_CONDCOLL:
        {
            ((SwCondCollPage&)rPage).SetCollection(
                ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(),bNewStyle);
            break;
        }

        case TP_PAGE_STD:
            if(0 == (nHtmlMode & HTMLMODE_ON ))
        {
            if(0 == (nHtmlMode & HTMLMODE_ON))
            {
                List aList;
                String* pNew = new String;
                SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
                aList.Insert( pNew, (sal_uLong)0 );
                if( pWrtShell )
                SwStyleNameMapper::FillUIName(RES_POOLCOLL_TEXT,*pNew);
                aList.Insert(pNew,(sal_uLong)0);

                if(pWrtShell)
                {
                    SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
                                GetView().GetDocShell()->GetStyleSheetPool();
                    SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
                    pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
                    SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();

                    while(pFirstStyle)
                    {
                        aList.Insert( new String(pFirstStyle->GetName()),
                                        aList.Count());
                        aList.Insert(new String(pFirstStyle->GetName()), aList.Count());
                        pFirstStyle = pStyleSheetPool->Next();
                    }
                }
                aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));

                //UUUU set DrawingLayer FillStyles active
                aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
                aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList));
                rPage.PageCreated(aSet);
                for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )

                for(sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i)
                {
                    delete (String*)aList.Remove(i);
                }
            }

            break;
        }

        case TP_MACRO_ASSIGN:
        {
            SfxAllItemSet aNewSet(*aSet.GetPool());
            aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
            if ( pWrtShell )
                rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
            aNewSet.Put(SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM));
            if(pWrtShell)
                rPage.SetFrame(pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface());
            rPage.PageCreated(aNewSet);
            break;
        }

        case RID_SVXPAGE_PICK_NUM:
            {
        {
                aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
                aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
                rPage.PageCreated(aSet);
            }
        break;
            break;
        }

        case RID_SVXPAGE_NUM_OPTIONS:
        {

            aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
            aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
            aSet.Put(SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
            aSet.Put(SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
            // Zeichenvorlagen sammeln
            ListBox rCharFmtLB(this);
            rCharFmtLB.Clear();
            rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
            rCharFmtLB.InsertEntry(ViewShell::GetShellRes()->aStrNone);
            SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
            ::FillCharStyleListBox(rCharFmtLB,  pDocShell);
            ::FillCharStyleListBox(rCharFmtLB,pDocShell);
            List aList;
            for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
            {

                 aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
                aList.Insert(new XubString(rCharFmtLB.GetEntry(j)),LIST_APPEND);
            }
            aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
            FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
            aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
            aSet.Put(SfxStringListItem(SID_CHAR_FMT_LIST_BOX,&aList));
            FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell,pDocShell));
            aSet.Put(SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
            rPage.PageCreated(aSet);
            for( sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i )
                    delete (XubString*)aList.Remove(i);
            for(sal_uInt16 i = (sal_uInt16)aList.Count(); i; --i)
                delete (XubString*)aList.Remove(i);
            aList.Clear();
            break;
        }
        break;

        case RID_SVXPAGE_NUM_POSITION:
        {
            SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
            FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
            FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell,pDocShell));

            aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
            aSet.Put(SfxAllEnumItem(SID_METRIC_ITEM,static_cast<sal_uInt16>(eMetric)));
            rPage.PageCreated(aSet);
            break;
        }
        break;
        case  RID_SVXPAGE_PICK_BULLET :
            {
                aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
                rPage.PageCreated(aSet);
            }
        break;

        case  RID_SVXPAGE_PICK_BULLET:
        {
            aSet.Put(SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
            rPage.PageCreated(aSet);
            break;
        }

        case  TP_HEADER_PAGE:
            if(0 == (nHtmlMode & HTMLMODE_ON ))
                ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
        break;
        case  TP_FOOTER_PAGE:
            if(0 == (nHtmlMode & HTMLMODE_ON ))
                ((SvxFooterPage&)rPage).EnableDynamicSpacing();
        break;
        case TP_BORDER :
            if( SFX_STYLE_FAMILY_PARA == nType )
        {
            if(0 == (nHtmlMode & HTMLMODE_ON))
            {
                aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
                static_cast< SvxHeaderPage& >(rPage).EnableDynamicSpacing();
            }
            else if( SFX_STYLE_FAMILY_FRAME == nType )
            {
                aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
            }

            //UUUU set DrawingLayer FillStyles active
            aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
            rPage.PageCreated(aSet);

        break;
            break;
        }

        case  TP_FOOTER_PAGE:
        {
            if(0 == (nHtmlMode & HTMLMODE_ON))
            {
                static_cast< SvxFooterPage& >(rPage).EnableDynamicSpacing();
            }

            //UUUU set DrawingLayer FillStyles active
            aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
            rPage.PageCreated(aSet);

            break;
        }

        case TP_BORDER:
        {
            if(SFX_STYLE_FAMILY_PARA == nType)
            {
                aSet.Put(SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
            }
            else if(SFX_STYLE_FAMILY_FRAME == nType)
            {
                aSet.Put(SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
            }
            rPage.PageCreated(aSet);
            break;
        }

        //UUUU inits for Area and Transparency TabPages
        // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
@@ -651,24 +715,20 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
        // demand, but could also be directly added from the DrawModel.
        case RID_SVXPAGE_AREA:
        {
            SfxItemSet aNew(*aSet.GetPool(),
                SID_COLOR_TABLE, SID_BITMAP_LIST,
                SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);

            aNew.Put(GetStyleSheet().GetItemSet());
            aSet.Put(GetStyleSheet().GetItemSet());

            // add flag for direct graphic content selection
            aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
            aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));

            rPage.PageCreated(aNew);
            rPage.PageCreated(aSet);
            break;
        }
        break;

        case RID_SVXPAGE_TRANSPARENCE:
        {
            rPage.PageCreated(GetStyleSheet().GetItemSet());
            break;
        }
        break;
    }
}

diff --git a/sw/source/ui/fmtui/tmpdlg.src b/sw/source/ui/fmtui/tmpdlg.src
index f9b23a4..383c114 100644
--- a/sw/source/ui/fmtui/tmpdlg.src
+++ b/sw/source/ui/fmtui/tmpdlg.src
@@ -148,14 +148,31 @@ TabDialog DLG_TEMPLATE_2
                Text [ en-US ] = "Drop Caps" ;
                PageResID = TP_DROPCAPS ;
            };

            //UUUU new Area and Transparence TabPages
            PageItem
            {
                Identifier = TP_BACKGROUND ;
                Text [ en-US ] = "Background" ;
                PageResID = TP_BACKGROUND ;
                Identifier = RID_SVXPAGE_AREA;
                PageResID = RID_SVXPAGE_AREA;
                Text [ en-US ] = "Area" ;
            };
            PageItem
            {
                Identifier = RID_SVXPAGE_TRANSPARENCE;
                PageResID = RID_SVXPAGE_TRANSPARENCE;
                Text [ en-US ] = "Transparency" ;
            };

            //UUUU remove?
            //PageItem
            //{
            //    Identifier = TP_BACKGROUND ;
            //    Text [ en-US ] = "Background" ;
            //    PageResID = TP_BACKGROUND ;
            //};

            PageItem
            {
                Identifier = TP_BORDER ;
                Text [ en-US ] = "Borders" ;
                PageResID = TP_BORDER ;
@@ -196,12 +213,28 @@ TabDialog DLG_TEMPLATE_4
                Text [ en-US ] = "Page" ;
                PageResID = TP_PAGE_STD ;
            };*/

            //UUUU new Area and Transparence TabPages
            PageItem
            {
                Identifier = TP_BACKGROUND ;
                Text [ en-US ] = "Background" ;
                PageResID = TP_BACKGROUND ;
                Identifier = RID_SVXPAGE_AREA;
                PageResID = RID_SVXPAGE_AREA;
                Text [ en-US ] = "Area" ;
            };
            PageItem
            {
                Identifier = RID_SVXPAGE_TRANSPARENCE;
                PageResID = RID_SVXPAGE_TRANSPARENCE;
                Text [ en-US ] = "Transparency" ;
            };

            //UUUU remove?
            //PageItem
            //{
            //    Identifier = TP_BACKGROUND ;
            //    Text [ en-US ] = "Background" ;
            //    PageResID = TP_BACKGROUND ;
            //};
            /*            PageItem
            {
                Identifier = TP_BORDER ;
diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx
index 81f348c..4df7a20 100644
--- a/sw/source/ui/frmdlg/colex.cxx
+++ b/sw/source/ui/frmdlg/colex.cxx
@@ -19,19 +19,12 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"




#include "cmdid.h"
#include "hintids.hxx"
#include <algorithm>


#include <svl/eitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
@@ -46,6 +39,9 @@
#include "colex.hxx"
#include "colmgr.hxx"

//UUUU
#include <svx/unobrushitemhelper.hxx>

/*-----------------------------------------------------------------------
    Beschreibung: Uebernahme der aktualisierten Werte aus dem Set
 -----------------------------------------------------------------------*/
@@ -128,12 +124,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
            SetHdLeft( rLR.GetLeft() );
            SetHdRight( rLR.GetRight() );
            SetHeader( sal_True );
            if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )

            if(SFX_ITEM_SET == rHeaderSet.GetItemState(RES_BACKGROUND))
            {
                const SvxBrushItem& rItem =
                    (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND );
                SetHdColor( rItem.GetColor() );
                //UUUU create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor());
                const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(RES_BACKGROUND));
                SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                setHeaderFillAttributes(
                    drawinglayer::attribute::SdrAllFillAttributesHelperPtr(
                        new drawinglayer::attribute::SdrAllFillAttributesHelper(
                            aTempSet)));
            }

            if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
            {
                const SvxBoxItem& rItem =
@@ -167,12 +171,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
            SetFtLeft( rLR.GetLeft() );
            SetFtRight( rLR.GetRight() );
            SetFooter( sal_True );

            if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )
            {
                const SvxBrushItem& rItem =
                    (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND );
                SetFtColor( rItem.GetColor() );
                //UUUU create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor());
                const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rFooterSet.Get(RES_BACKGROUND));
                SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

                setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
                setFooterFillAttributes(
                    drawinglayer::attribute::SdrAllFillAttributesHelperPtr(
                        new drawinglayer::attribute::SdrAllFillAttributesHelper(
                            aTempSet)));
            }

            if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
            {
                const SvxBoxItem& rItem =
@@ -183,19 +195,18 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
        else
            SetFooter( sal_False );
    }
    if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND,
            sal_False, &pItem ) )
    {
        SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
        const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();

        if ( pGrf )
        {
            Bitmap aBitmap = pGrf->GetBitmap();
            SetBitmap( &aBitmap );
        }
        else
            SetBitmap( NULL );
    if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, sal_False, &pItem))
    {
        //UUUU create FillAttributes from SvxBrushItem
        const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
        SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

        setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
        setPageFillAttributes(
            drawinglayer::attribute::SdrAllFillAttributesHelperPtr(
                new drawinglayer::attribute::SdrAllFillAttributesHelper(
                    aTempSet)));
    }

    Invalidate();
@@ -233,14 +244,23 @@ void SwColExample::DrawPage( const Point& rOrg,
                        - GetFtHeight() - GetFtDist();
        DrawRect(aRect);

        if(GetColor() == Color(COL_TRANSPARENT))
        //UUUU
        const Rectangle aDefineRect(aRect);

        //UUUU
        const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes();

        if(!rFillAttributes.get() || !rFillAttributes->isUsed())
        {
            //UUUU If there is no fill, use fallback color
            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
            const Color& rFieldColor = rStyleSettings.GetFieldColor();
            SetFillColor( rFieldColor );

            setPageFillAttributes(
                drawinglayer::attribute::SdrAllFillAttributesHelperPtr(
                    new drawinglayer::attribute::SdrAllFillAttributesHelper(
                        rFieldColor)));
        }
        else
            SetFillColor( GetColor() );

        // #97495# make sure that the automatic column widht's are always equal
        sal_Bool bAutoWidth = pColMgr->IsAutoWidth();
@@ -260,7 +280,10 @@ void SwColExample::DrawPage( const Point& rOrg,
            if(!bAutoWidth)
                nAutoColWidth = pColMgr->GetColWidth( i );
            aRect.Right() = aRect.Left() + nAutoColWidth;
            DrawRect(aRect);

            //UUUU use primitive draw command
            drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect);

            if(i < nColumnCount - 1)
                aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i);
        }
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 7068593..0e70a6b 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

@@ -28,7 +26,6 @@
#include <hintids.hxx>
#include <svl/urihelper.hxx>
#include <svl/languageoptions.hxx>

#include <svx/svxids.hrc>
#include <sfx2/linkmgr.hxx>
#include <svx/htmlmode.hxx>
@@ -101,7 +98,6 @@
#include <crsskip.hxx>
#include <fmtinfmt.hxx>
#include <doc.hxx>

#include "swabstdlg.hxx"
#include "dialog.hrc"
#include "fldui.hrc"
@@ -111,13 +107,14 @@
#include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE
#include <SwRewriter.hxx>
#include <comcore.hrc>

#include <unomid.h>
#include <svx/galleryitem.hxx>
#include <com/sun/star/gallery/GalleryItemType.hpp>

FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
//UUUU
#include <svx/unobrushitemhelper.hxx>

FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;

//Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH
//ankommt.
@@ -2256,28 +2253,10 @@ void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
void SwBaseShell::GetBckColState(SfxItemSet &rSet)
{
    SwWrtShell &rSh = GetShell();
    SfxWhichIter aIter( rSet );
    sal_uInt16 nWhich = aIter.FirstWhich();
    int nSelType = rSh.GetSelectionType();

//  if ( nSelType & nsSelectionType::SEL_GRF ||
    if( nSelType & nsSelectionType::SEL_OLE )
    {
        rSet.DisableItem( SID_BACKGROUND_COLOR );
        return;
    }

    if ( nSelType & nsSelectionType::SEL_FRM )
    {
        sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
        if (bParentCntProt)
        {
            rSet.DisableItem( SID_BACKGROUND_COLOR );
            return;
        }
    }

    SvxBrushItem aBrushItem( RES_BACKGROUND );
    SfxWhichIter aIter(rSet);
    sal_uInt16 nWhich(aIter.FirstWhich());
    int nSelType(rSh.GetSelectionType());
    SvxBrushItem aBrushItem(RES_BACKGROUND);

    if( nsSelectionType::SEL_TBL_CELLS & nSelType )
    {
@@ -2285,54 +2264,41 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
    }
    else
    {
        //UUUU
        if(nSelType & nsSelectionType::SEL_GRF)
        //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
        SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

        aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet());

        if(nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType)
        {
            SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);

            rSh.GetFlyFrmAttr( aCoreSet );
            aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
        }
        else if(nsSelectionType::SEL_FRM & nSelType)
        {
            SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
            const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem&  >(aCoreSet.Get(XATTR_FILLSTYLE)));

            if(XFILL_SOLID == rXFillStyleItem.GetValue())
            {
                const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue());

                aBrushItem.SetColor(aFillColor);
            }
            else
            {
                // keep default in SvxBrushItem which equals no fill
            }
            rSh.GetFlyFrmAttr(aCoreSet);
        }
        else
        {
            SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);

            rSh.GetCurAttr( aCoreSet );
            aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
            rSh.GetCurAttr(aCoreSet);
        }

        aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
    }

    while ( nWhich )
    while(nWhich)
    {
        switch(nWhich)
        {
            case SID_BACKGROUND_COLOR  :
            case SID_BACKGROUND_COLOR:
            {
                SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR);
                rSet.Put( aColorItem, SID_BACKGROUND_COLOR );
                SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR);
                rSet.Put(aColorItem,SID_BACKGROUND_COLOR);
                break;
            }
            break;
            case SID_ATTR_BRUSH:
            case RES_BACKGROUND:
                rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) );
            break;
            {
                rSet.Put(aBrushItem,GetPool().GetWhich(nWhich));
                break;
            }
        }

        nWhich = aIter.NextWhich();
    }
}
@@ -2344,18 +2310,16 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
void SwBaseShell::ExecBckCol(SfxRequest& rReq)
{
    SwWrtShell &rSh = GetShell();
    int nSelType = rSh.GetSelectionType();
    if ( nSelType & nsSelectionType::SEL_OLE )
    int nSelType(rSh.GetSelectionType());
    const SfxItemSet* pArgs = rReq.GetArgs();
    sal_uInt16 nSlot(rReq.GetSlot());

    if(!pArgs  && nSlot != SID_BACKGROUND_COLOR)
    {
        return;
    }

    const SfxItemSet* pArgs = rReq.GetArgs();
    sal_uInt16 nSlot = rReq.GetSlot();
    if( !pArgs  && nSlot != SID_BACKGROUND_COLOR)
        return ;

    SvxBrushItem aBrushItem( RES_BACKGROUND );
    SvxBrushItem aBrushItem(RES_BACKGROUND);

    if( nsSelectionType::SEL_TBL_CELLS & nSelType )
    {
@@ -2363,129 +2327,98 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
    }
    else
    {
        //UUUU
        if(nSelType & nsSelectionType::SEL_GRF)
        //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
        SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

        aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet());

        if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType))
        {
            SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);

            rSh.GetFlyFrmAttr( aCoreSet );
            aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
        }
        else if(nsSelectionType::SEL_FRM & nSelType)
        {
            SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
            const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem&  >(aCoreSet.Get(XATTR_FILLSTYLE)));

            if(XFILL_SOLID == rXFillStyleItem.GetValue())
            {
                const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue());

                aBrushItem.SetColor(aFillColor);
            }
            else
            {
                // keep default in SvxBrushItem which equals no fill
            }
            rSh.GetFlyFrmAttr(aCoreSet);
        }
        else
        {
            SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);

            rSh.GetCurAttr( aCoreSet );
            aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
            rSh.GetCurAttr(aCoreSet);
        }

        aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
    }

//  sal_Bool bMsgOk = sal_False;

    switch (nSlot)
    switch(nSlot)
    {
        // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
        // gesetzt werden:
        case SID_BACKGROUND_COLOR:
            {
                aBrushItem.SetGraphicPos(GPOS_NONE);
        {
            aBrushItem.SetGraphicPos(GPOS_NONE);

                //Brush &rBrush = aBrushItem.GetBrush();
                if(pArgs)
                {
                    const SvxColorItem& rNewColorItem = (const SvxColorItem&)
                                            pArgs->Get(SID_BACKGROUND_COLOR);
                    const Color& rNewColor = rNewColorItem.GetValue();
                    aBrushItem.SetColor( rNewColor );
                    GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
                }
                else
                {
                    aBrushItem.SetColor( COL_TRANSPARENT );
                    rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) );
                }
            if(pArgs)
            {
                const SvxColorItem& rNewColorItem = (const SvxColorItem&)pArgs->Get(SID_BACKGROUND_COLOR);
                const Color& rNewColor = rNewColorItem.GetValue();
                aBrushItem.SetColor(rNewColor);
                GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
            }
            else
            {
                aBrushItem.SetColor(COL_TRANSPARENT);
                rReq.AppendItem(SvxColorItem(Color(COL_TRANSPARENT),nSlot));
            }
            break;
        }

        case SID_ATTR_BRUSH:
        case RES_BACKGROUND:
        {
            const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)
                                    pArgs->Get( GetPool().GetWhich(nSlot) );
            const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)pArgs->Get(GetPool().GetWhich(nSlot));
            aBrushItem = rNewBrushItem;
            break;
        }
        break;
        default:
//          bMsgOk = sal_False;
        {
            rReq.Ignore();
            DBG_ERROR( "Unbekannte Message bei ExecuteAttr!" );
            DBG_ERROR("Unbekannte Message bei ExecuteAttr!");
            return;
        }
    }

    if( nsSelectionType::SEL_TBL_CELLS & nSelType )
    {
        rSh.SetBoxBackground( aBrushItem );
    }
    //UUUU
    else if(nsSelectionType::SEL_GRF & nSelType)
    {
        SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
        aCoreSet.Put( aBrushItem );
        // Vorlagen-AutoUpdate
        SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
        if(pFmt && pFmt->IsAutoUpdateFmt())
            rSh.AutoUpdateFrame( pFmt, aCoreSet);
        else
            rSh.SetFlyFrmAttr( aCoreSet );
    }
    else if(nsSelectionType::SEL_FRM & nSelType)
    {
        SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
        const XubString aNullStr;

        // set FillStyle and color when applying
        aCoreSet.Put(XFillStyleItem(XFILL_SOLID));
        aCoreSet.Put(XFillColorItem(aNullStr, aBrushItem.GetColor()));

        // Vorlagen-AutoUpdate
        SwFrmFmt* pFmt = rSh.GetCurFrmFmt();

        if(pFmt && pFmt->IsAutoUpdateFmt())
        {
            rSh.AutoUpdateFrame( pFmt, aCoreSet);
        }
        else
        {
            rSh.SetFlyFrmAttr( aCoreSet );
        }
    }
    else
    {
        SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
        if( pColl && pColl->IsAutoUpdateFmt())
        //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
        SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);

        aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet());
        setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, aCoreSet);

        if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType))
        {
            SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND );
            aSet.Put(aBrushItem);
            rSh.AutoUpdatePara( pColl, aSet);
            // Vorlagen-AutoUpdate
            SwFrmFmt* pFmt = rSh.GetCurFrmFmt();

            if(pFmt && pFmt->IsAutoUpdateFmt())
            {
                rSh.AutoUpdateFrame(pFmt, aCoreSet);
            }
            else
            {
                rSh.SetFlyFrmAttr(aCoreSet);
            }
        }
        else
            rSh.SetAttrItem( aBrushItem );
        {
            SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();

            if(pColl && pColl->IsAutoUpdateFmt())
            {
                rSh.AutoUpdatePara(pColl, aCoreSet);
            }
            else
            {
                rSh.SetAttrSet(aCoreSet);
            }
        }
    }

    rReq.Done();
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 722a6bb..c33e766 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -133,6 +133,9 @@
#include <svx/nbdtmg.hxx>
#endif

//UUUU
#include <svx/svdmodel.hxx>
#include <svx/drawitem.hxx>

#include <numrule.hxx>

@@ -896,27 +899,45 @@ void SwTextShell::Execute(SfxRequest &rReq)
        {
            FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
            SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
            SfxItemSet aCoreSet( GetPool(),
                            RES_PARATR_BEGIN,           RES_PARATR_END - 1,
                            // --> OD 2008-02-25 #refactorlists#
                            RES_PARATR_LIST_BEGIN,      RES_PARATR_LIST_END - 1,
                            // <--
                            RES_FRMATR_BEGIN,           RES_FRMATR_END - 1,
                            SID_ATTR_TABSTOP_POS,       SID_ATTR_TABSTOP_POS,
                            SID_ATTR_TABSTOP_DEFAULTS,  SID_ATTR_TABSTOP_DEFAULTS,
                            SID_ATTR_TABSTOP_OFFSET,    SID_ATTR_TABSTOP_OFFSET,
                            SID_ATTR_BORDER_INNER,      SID_ATTR_BORDER_INNER,
                            SID_ATTR_PARA_MODEL,        SID_ATTR_PARA_KEEP,
                            SID_ATTR_PARA_PAGENUM,      SID_ATTR_PARA_PAGENUM,
                            SID_HTML_MODE,              SID_HTML_MODE,
                            FN_PARAM_1,                 FN_PARAM_1,
                            FN_NUMBER_NEWSTART,         FN_NUMBER_NEWSTART_AT,
                            FN_DROP_TEXT,               FN_DROP_CHAR_STYLE_NAME,
            SfxItemSet aCoreSet( GetPool(), //UUUU sorted by indices, one group of three concatenated
                            RES_PARATR_BEGIN,           RES_PARATR_END - 1,         // [60
                            RES_PARATR_LIST_BEGIN,      RES_PARATR_LIST_END - 1,    // [77
                            RES_FRMATR_BEGIN,           RES_FRMATR_END - 1,         // [82

                            //UUUU FillAttribute support
                            XATTR_FILL_FIRST, XATTR_FILL_LAST,                      // [1014

                            // includes SID_ATTR_TABSTOP_POS
                            SID_ATTR_TABSTOP_DEFAULTS,  SID_ATTR_TABSTOP_OFFSET,    // [10003 .. 10005

                            SID_ATTR_BORDER_INNER,      SID_ATTR_BORDER_INNER,      // [10023
                            SID_ATTR_PARA_MODEL,        SID_ATTR_PARA_KEEP,         // [10065

                            //UUUU items to hand over XPropertyList things like
                            // XColorList, XHatchList, XGradientList and XBitmapList
                            // to the Area TabPage
                            SID_COLOR_TABLE,        SID_BITMAP_LIST,                // [10179

                            SID_HTML_MODE,              SID_HTML_MODE,              // [10414
                            SID_ATTR_PARA_PAGENUM,      SID_ATTR_PARA_PAGENUM,      // [10457
                            FN_PARAM_1,                 FN_PARAM_1,                 // [21160
                            FN_NUMBER_NEWSTART,         FN_NUMBER_NEWSTART_AT,      // [21738
                            FN_DROP_TEXT,               FN_DROP_CHAR_STYLE_NAME,    // [22418
                            0);
            // --> OD 2008-01-16 #newlistlevelattrs#

            // get also the list level indent values merged as LR-SPACE item, if needed.
            rWrtSh.GetCurAttr( aCoreSet, true );
            // <--

            //UUUU create needed items for XPropertyList entries from the DrawModel so that
            // the Area TabPage can access them
            // Do this after GetCurAttr, this resets the ItemSet content again
            const SdrModel* pDrawModel = GetView().GetDocShell()->GetDoc()->GetDrawModel();

            aCoreSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
            aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
            aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST));
            aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST));

            aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
                            ::GetHtmlMode(GetView().GetDocShell())));

diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx
index 65d3bf5..afa591e 100644
--- a/sw/source/ui/uiview/viewstat.cxx
+++ b/sw/source/ui/uiview/viewstat.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"

@@ -30,7 +28,6 @@
#include <svl/aeitem.hxx>
#include <svl/whiter.hxx>
#include <svl/cjkoptions.hxx>

#include <sfx2/viewfrm.hxx>
#include <sfx2/objitem.hxx>
#include <svl/imageitm.hxx>
@@ -58,11 +55,12 @@
#include <svl/stritem.hxx>
#include <unotools/moduleoptions.hxx>
#include <svl/visitem.hxx>

#include <cmdid.h>

#include <IDocumentRedlineAccess.hxx>

//UUUU
#include <doc.hxx>

using namespace ::com::sun::star;

/*--------------------------------------------------------------------
@@ -144,6 +142,15 @@ void SwView::GetState(SfxItemSet &rSet)
            {
                const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
                const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx );

                //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
                if(!rSet.GetParent())
                {
                    const SwFrmFmt& rMaster = rDesc.GetMaster();

                    rSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet());
                }

                ::PageDescToItemSet( rDesc, rSet);
            }
            break;
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index 78a2d38..4db50c9 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -385,12 +385,19 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)

        // HeaderInfo, Raender, Hintergrund, Umrandung
        //
        SfxItemSet aHeaderSet( *rSet.GetPool(),
                    SID_ATTR_PAGE_ON,       SID_ATTR_PAGE_SHARED,
                    SID_ATTR_PAGE_SIZE,     SID_ATTR_PAGE_SIZE,
                    SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,
                    RES_FRMATR_BEGIN,       RES_FRMATR_END-1,
                    0);
        SfxItemSet aHeaderSet(*rSet.GetPool(),
            RES_FRMATR_BEGIN,RES_FRMATR_END - 1,            // [82

            //UUUU FillAttribute support
            XATTR_FILL_FIRST, XATTR_FILL_LAST,              // [1014

            SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER,    // [10023
            SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE,          // [10051
            SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED,          // [10060
            0, 0);

        //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
        aHeaderSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet());

        // dynamische oder feste Hoehe
        //
@@ -431,12 +438,19 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)

        // FooterInfo, Raender, Hintergrund, Umrandung
        //
        SfxItemSet aFooterSet( *rSet.GetPool(),
                    SID_ATTR_PAGE_ON,       SID_ATTR_PAGE_SHARED,
                    SID_ATTR_PAGE_SIZE,     SID_ATTR_PAGE_SIZE,
                    SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,
                    RES_FRMATR_BEGIN,       RES_FRMATR_END-1,
                    0);
        SfxItemSet aFooterSet(*rSet.GetPool(),
            RES_FRMATR_BEGIN,RES_FRMATR_END - 1,            // [82

            //UUUU FillAttribute support
            XATTR_FILL_FIRST, XATTR_FILL_LAST,              // [1014

            SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER,    // [10023
            SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE,          // [10051
            SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED,          // [10060
            0, 0);

        //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
        aFooterSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet());

        // dynamische oder feste Hoehe
        //
diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx
index a18d39a..0f6608c 100644
--- a/xmloff/inc/PageMasterImportContext.hxx
+++ b/xmloff/inc/PageMasterImportContext.hxx
@@ -29,7 +29,12 @@

class PageStyleContext : public XMLPropStyleContext
{
    ::rtl::OUString sPageUsage;
private:
    ::rtl::OUString     sPageUsage;

    //UUUU
    bool                m_bIsFillStyleAlreadyConverted : 1;

protected:

    virtual void SetAttribute( sal_uInt16 nPrefixKey,
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 381dad2..e93e567 100644
--- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -90,6 +90,17 @@
#define CTF_PM_GRAPHICFILTER            (XML_PM_CTF_START + 0x0033)
#define CTF_PM_GRAPHICURL               (XML_PM_CTF_START + 0x0034)

//UUUUNeed own entries for PageMasterStyleMap since these get *filtered*
// at export time using CTF_PM_FLAGMASK and XML_PM_CTF_START as detector
// to find the first entry for header/footer (!), see
// SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER
#define CTF_PM_REPEAT_OFFSET_X          (XML_PM_CTF_START + 0x0035)
#define CTF_PM_REPEAT_OFFSET_Y          (XML_PM_CTF_START + 0x0036)
#define CTF_PM_FILLGRADIENTNAME         (XML_PM_CTF_START + 0x0037)
#define CTF_PM_FILLHATCHNAME            (XML_PM_CTF_START + 0x0038)
#define CTF_PM_FILLBITMAPNAME           (XML_PM_CTF_START + 0x0039)
#define CTF_PM_FILLTRANSNAME            (XML_PM_CTF_START + 0x0040)

#define CTF_PM_SCALETO                  (XML_PM_CTF_START + 0x0051) // calc specific
#define CTF_PM_SCALETOPAGES             (XML_PM_CTF_START + 0x0052)
#define CTF_PM_SCALETOX                 (XML_PM_CTF_START + 0x0053)
@@ -125,6 +136,14 @@
#define CTF_PM_HEADERMARGINLEFT         (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT)
#define CTF_PM_HEADERMARGINRIGHT        (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT)

//UUUUNeed own entries for PageMasterStyleMap ORed with the CTF_PM_HEADERFLAG
#define CTF_PM_HEADERREPEAT_OFFSET_X    (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_X)
#define CTF_PM_HEADERREPEAT_OFFSET_Y    (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_Y)
#define CTF_PM_HEADERFILLGRADIENTNAME   (CTF_PM_HEADERFLAG|CTF_PM_FILLGRADIENTNAME)
#define CTF_PM_HEADERFILLHATCHNAME      (CTF_PM_HEADERFLAG|CTF_PM_FILLHATCHNAME)
#define CTF_PM_HEADERFILLBITMAPNAME     (CTF_PM_HEADERFLAG|CTF_PM_FILLBITMAPNAME)
#define CTF_PM_HEADERFILLTRANSNAME      (CTF_PM_HEADERFLAG|CTF_PM_FILLTRANSNAME)

// footer
#define CTF_PM_FOOTERBORDERALL          (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL)
#define CTF_PM_FOOTERBORDERTOP          (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP)
@@ -153,6 +172,14 @@
#define CTF_PM_FOOTERMARGINLEFT         (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT)
#define CTF_PM_FOOTERMARGINRIGHT        (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT)

//UUUUNeed own entries for PageMasterStyleMap ORed with the CTF_PM_FOOTERFLAG
#define CTF_PM_FOOTERREPEAT_OFFSET_X    (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_X)
#define CTF_PM_FOOTERREPEAT_OFFSET_Y    (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_Y)
#define CTF_PM_FOOTERFILLGRADIENTNAME   (CTF_PM_FOOTERFLAG|CTF_PM_FILLGRADIENTNAME)
#define CTF_PM_FOOTERFILLHATCHNAME      (CTF_PM_FOOTERFLAG|CTF_PM_FILLHATCHNAME)
#define CTF_PM_FOOTERFILLBITMAPNAME     (CTF_PM_FOOTERFLAG|CTF_PM_FILLBITMAPNAME)
#define CTF_PM_FOOTERFILLTRANSNAME      (CTF_PM_FOOTERFLAG|CTF_PM_FILLTRANSNAME)

#define CTF_PM_FTN_HEIGTH               (XML_PM_CTF_START + 0x0060)
#define CTF_PM_FTN_LINE_WEIGTH          (XML_PM_CTF_START + 0x0061)
#define CTF_PM_FTN_LINE_COLOR           (XML_PM_CTF_START + 0x0062)
diff --git a/xmloff/inc/xmloff/XMLShapeStyleContext.hxx b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx
index c7f4776..2492b28 100644
--- a/xmloff/inc/xmloff/XMLShapeStyleContext.hxx
+++ b/xmloff/inc/xmloff/XMLShapeStyleContext.hxx
@@ -40,8 +40,9 @@ protected:
    ::rtl::OUString     m_sControlDataStyleName;
    ::rtl::OUString     m_sListStyleName;
    sal_Bool            m_bIsNumRuleAlreadyConverted;

    //UUUU
    sal_Bool            m_bIsFillStyleAlreadyConverted;
    bool                m_bIsFillStyleAlreadyConverted : 1;

protected:
    virtual void SetAttribute( sal_uInt16 nPrefixKey,
diff --git a/xmloff/inc/xmloff/prstylei.hxx b/xmloff/inc/xmloff/prstylei.hxx
index c592110..0eefe49 100644
--- a/xmloff/inc/xmloff/prstylei.hxx
+++ b/xmloff/inc/xmloff/prstylei.hxx
@@ -27,12 +27,11 @@
#include "xmloff/dllapi.h"
#include "sal/types.h"
#include <com/sun/star/style/XStyle.hpp>
#ifndef __SGI_STL_VECTOR
#include <vector>
#endif
#ifndef _XMLOFF_XMLSTYLE_HXX_
#include <xmloff/xmlstyle.hxx>
#endif

//UUUU
#include <hash_set>

struct XMLPropertyState;
class SvXMLStylesContext;
@@ -41,19 +40,53 @@ namespace com { namespace sun { namespace star {
    namespace beans { class XPropertySet; }
} } }

//UUUU
typedef std::hash_set< rtl::OUString, rtl::OUStringHash > OldFillStyleDefinitionSet;

class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
{
private:
    const ::rtl::OUString msIsPhysical;
    const ::rtl::OUString msFollowStyle;
    ::std::vector< XMLPropertyState > maProperties;
    ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
    SvXMLImportContextRef               mxStyles;

    //UUUU
    static OldFillStyleDefinitionSet maStandardSet;
    static OldFillStyleDefinitionSet maHeaderSet;
    static OldFillStyleDefinitionSet maFooterSet;
    static OldFillStyleDefinitionSet maParaSet;

    SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined
    SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined

protected:

    //UUUU Helper to check if the local maProperties contzains the given
    // FillStyle tag and if the FillStyle there is different from FillStyle_NONE
    bool doNewDrawingLayerFillStyleDefinitionsExist(
        const ::rtl::OUString& rFillStyleTag) const;

    //UUUU Helper which will deactivate all old fill definitions (identified by
    // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
    // is done setting theindex to -1. It returns true when actually old fill
    // definitions existed and were deactivated
    bool deactivateOldFillStyleDefinitions(
        const OldFillStyleDefinitionSet& rHashSetOfTags);

    //UUUU Helper to translate new DrawingLayer FillStyle values which are name-based
    // from ODF internal name to style display names which can be found in the current
    // document model (using NameOrIndex Items). The change is executed on the internal
    // maProperties. The return value is true when actually names were changed
    bool translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();

    //UUUU provider for often used sets
    const OldFillStyleDefinitionSet& getStandardSet();
    const OldFillStyleDefinitionSet& getHeaderSet();
    const OldFillStyleDefinitionSet& getFooterSet();
    const OldFillStyleDefinitionSet& getParaSet();

    virtual void SetAttribute( sal_uInt16 nPrefixKey,
                               const ::rtl::OUString& rLocalName,
                               const ::rtl::OUString& rValue );
diff --git a/xmloff/inc/xmloff/txtprmap.hxx b/xmloff/inc/xmloff/txtprmap.hxx
index 4f7f862..45f40e0 100644
--- a/xmloff/inc/xmloff/txtprmap.hxx
+++ b/xmloff/inc/xmloff/txtprmap.hxx
@@ -182,14 +182,6 @@
#define CTF_MARGINTOP                       (XML_TEXT_CTF_START + 151)
#define CTF_MARGINBOTTOM                    (XML_TEXT_CTF_START + 152)

//UUUU
#define CTF_SW_REPEAT_OFFSET_X              (XML_TEXT_CTF_START + 153)
#define CTF_SW_REPEAT_OFFSET_Y              (XML_TEXT_CTF_START + 154)
#define CTF_SW_FILLGRADIENTNAME             (XML_TEXT_CTF_START + 155)
#define CTF_SW_FILLHATCHNAME                (XML_TEXT_CTF_START + 156)
#define CTF_SW_FILLBITMAPNAME               (XML_TEXT_CTF_START + 157)
#define CTF_SW_FILLTRANSNAME                (XML_TEXT_CTF_START + 158)

#define TEXT_PROP_MAP_TEXT 0
#define TEXT_PROP_MAP_PARA 1
#define TEXT_PROP_MAP_FRAME 2
diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx
new file mode 100755
index 0000000..d38495b
--- /dev/null
+++ b/xmloff/inc/xmlsdtypes.hxx
@@ -0,0 +1,208 @@
/**************************************************************
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/

#ifndef _XMLSDTYPES_HXX
#define _XMLSDTYPES_HXX

//#include <xmloff/xmlnume.hxx>
//#include <xmloff/maptype.hxx>
#include <xmloff/xmltypes.hxx>
//#include <xmloff/xmlement.hxx>
//#include <xmloff/prhdlfac.hxx>
//#include <xmloff/xmlprmap.hxx>
//#include "xmloff/XMLTextListAutoStylePool.hxx"
//#include <xmloff/xmlexppr.hxx>

//////////////////////////////////////////////////////////////////////////////
// types of own properties

#define XML_SD_TYPE_STROKE                          (XML_SD_TYPES_START +  0)
#define XML_SD_TYPE_PRESPAGE_TYPE                   (XML_SD_TYPES_START +  1)
#define XML_SD_TYPE_PRESPAGE_STYLE                  (XML_SD_TYPES_START +  2)
#define XML_SD_TYPE_PRESPAGE_SPEED                  (XML_SD_TYPES_START +  3)
#define XML_SD_TYPE_PRESPAGE_DURATION               (XML_SD_TYPES_START +  4)
#define XML_SD_TYPE_PRESPAGE_VISIBILITY             (XML_SD_TYPES_START +  5)
#define XML_SD_TYPE_MARKER                          (XML_SD_TYPES_START +  6 )
#define XML_SD_TYPE_OPACITY                         (XML_SD_TYPES_START +  7 )
#define XML_SD_TYPE_LINEJOIN                        (XML_SD_TYPES_START +  8 )
#define XML_SD_TYPE_FILLSTYLE                       (XML_SD_TYPES_START +  9 )
#define XML_SD_TYPE_GRADIENT                        (XML_SD_TYPES_START + 10 )
#define XML_SD_TYPE_GRADIENT_STEPCOUNT              (XML_SD_TYPES_START + 11 )
#define XML_SD_TYPE_SHADOW                          (XML_SD_TYPES_START + 12 )
#define XML_SD_TYPE_TEXT_CROSSEDOUT                 (XML_SD_TYPES_START + 13 )
#define XML_SD_TYPE_NUMBULLET                       (XML_SD_TYPES_START + 14 )
#define XML_SD_TYPE_WRITINGMODE                     (XML_SD_TYPES_START + 15 )
#define XML_SD_TYPE_BITMAP_MODE                     (XML_SD_TYPES_START + 16 )
#define XML_SD_TYPE_BITMAPREPOFFSETX                (XML_SD_TYPES_START + 17 )
#define XML_SD_TYPE_BITMAPREPOFFSETY                (XML_SD_TYPES_START + 18 )
#define XML_SD_TYPE_FILLBITMAPSIZE                  (XML_SD_TYPES_START + 19 )
#define XML_SD_TYPE_LOGICAL_SIZE                    (XML_SD_TYPES_START + 20 )
#define XML_SD_TYPE_BITMAP_REFPOINT                 (XML_SD_TYPES_START + 21 )
#define XML_SD_TYPE_PRESPAGE_BACKSIZE               (XML_SD_TYPES_START + 22 )
#define XML_TYPE_TEXT_ANIMATION_BLINKING            (XML_SD_TYPES_START + 23 )
#define XML_TYPE_TEXT_ANIMATION_STEPS               (XML_SD_TYPES_START + 24 )
#define XML_SD_TYPE_TEXT_ALIGN                      (XML_SD_TYPES_START + 25 )
#define XML_SD_TYPE_VERTICAL_ALIGN                  (XML_SD_TYPES_START + 26 )
#define XML_SD_TYPE_FITTOSIZE                       (XML_SD_TYPES_START + 27 )
#define XML_SD_TYPE_MEASURE_HALIGN                  (XML_SD_TYPES_START + 28 )
#define XML_SD_TYPE_MEASURE_VALIGN                  (XML_SD_TYPES_START + 29 )
#define XML_SD_TYPE_MEASURE_UNIT                    (XML_SD_TYPES_START + 30 )
#define XML_SD_TYPE_MEASURE_PLACING                 (XML_SD_TYPES_START + 31 )
#define XML_SD_TYPE_CONTROL_BORDER                  (XML_SD_TYPES_START + 32 )
#define XML_SD_TYPE_CONTROL_BORDER_COLOR            (XML_SD_TYPES_START + 33 )
#define XML_SD_TYPE_IMAGE_SCALE_MODE                (XML_SD_TYPES_START + 34 )
#define XML_SD_TYPE_LINECAP                         (XML_SD_TYPES_START + 35 )

//////////////////////////////////////////////////////////////////////////////
// 3D property types
#define XML_SD_TYPE_BACKFACE_CULLING                (XML_SD_TYPES_START + 40 )
#define XML_SD_TYPE_NORMALS_KIND                    (XML_SD_TYPES_START + 41 )
#define XML_SD_TYPE_NORMALS_DIRECTION               (XML_SD_TYPES_START + 42 )
#define XML_SD_TYPE_TEX_GENERATION_MODE_X           (XML_SD_TYPES_START + 43 )
#define XML_SD_TYPE_TEX_GENERATION_MODE_Y           (XML_SD_TYPES_START + 44 )
#define XML_SD_TYPE_TEX_KIND                        (XML_SD_TYPES_START + 45 )
#define XML_SD_TYPE_TEX_MODE                        (XML_SD_TYPES_START + 46 )

//////////////////////////////////////////////////////////////////////////////
// #FontWork# types
#define XML_SD_TYPE_FONTWORK_STYLE                  (XML_SD_TYPES_START + 47 )
#define XML_SD_TYPE_FONTWORK_ADJUST                 (XML_SD_TYPES_START + 48 )
#define XML_SD_TYPE_FONTWORK_SHADOW                 (XML_SD_TYPES_START + 49 )
#define XML_SD_TYPE_FONTWORK_FORM                   (XML_SD_TYPES_START + 50 )

//////////////////////////////////////////////////////////////////////////////
// Caption types
#define XML_SD_TYPE_CAPTION_ANGLE_TYPE              (XML_SD_TYPES_START + 60 )
#define XML_SD_TYPE_CAPTION_IS_ESC_REL              (XML_SD_TYPES_START + 61 )
#define XML_SD_TYPE_CAPTION_ESC_REL                 (XML_SD_TYPES_START + 62 )
#define XML_SD_TYPE_CAPTION_ESC_ABS                 (XML_SD_TYPES_START + 63 )
#define XML_SD_TYPE_CAPTION_ESC_DIR                 (XML_SD_TYPES_START + 64 )
#define XML_SD_TYPE_CAPTION_TYPE                    (XML_SD_TYPES_START + 65 )

//////////////////////////////////////////////////////////////////////////////
// header & footer types
#define XML_SD_TYPE_DATETIMEUPDATE                  (XML_SD_TYPES_START + 70 )
#define XML_SD_TYPE_DATETIME_FORMAT                 (XML_SD_TYPES_START + 71 )

//////////////////////////////////////////////////////////////////////////////
// new types for merged style:protect attribute
#define XML_SD_TYPE_MOVE_PROTECT                    (XML_SD_TYPES_START + 72 )
#define XML_SD_TYPE_SIZE_PROTECT                    (XML_SD_TYPES_START + 73 )

//////////////////////////////////////////////////////////////////////////////
// new type for style:mirror attribute
#define XML_TYPE_SD_MIRROR                          (XML_SD_TYPES_START + 74 )

//////////////////////////////////////////////////////////////////////////////
// new smil transition types for pages
#define XML_SD_TYPE_TRANSITION_TYPE                 (XML_SD_TYPES_START + 75 )
#define XML_SD_TYPE_TRANSTIION_SUBTYPE              (XML_SD_TYPES_START + 76 )
#define XML_SD_TYPE_TRANSTIION_DIRECTION            (XML_SD_TYPES_START + 77 )
#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE   (XML_SD_TYPES_START + 78 )

//////////////////////////////////////////////////////////////////////////////

#define CTF_NUMBERINGRULES          1000
#define CTF_CONTROLWRITINGMODE      1001
#define CTF_WRITINGMODE             1002
#define CTF_REPEAT_OFFSET_X         1003
#define CTF_REPEAT_OFFSET_Y         1004
#define CTF_PAGE_SOUND_URL          1005
#define CTF_PAGE_VISIBLE            1006
#define CTF_PAGE_TRANS_TYPE         1007
#define CTF_PAGE_TRANS_STYLE        1008
#define CTF_PAGE_TRANS_SPEED        1009
#define CTF_PAGE_TRANS_DURATION     1010
#define CTF_PAGE_BACKSIZE           1011
#define CTF_DASHNAME                1012
#define CTF_LINESTARTNAME           1013
#define CTF_LINEENDNAME             1014
#define CTF_FILLGRADIENTNAME        1015
#define CTF_FILLHATCHNAME           1016
#define CTF_FILLBITMAPNAME          1017
#define CTF_FILLTRANSNAME           1018
#define CTF_TEXTANIMATION_BLINKING  1019
#define CTF_TEXTANIMATION_KIND      1020

#define CTF_PAGE_TRANSITION_TYPE        1021
#define CTF_PAGE_TRANSITION_SUBTYPE     1022
#define CTF_PAGE_TRANSITION_DIRECTION   1023
#define CTF_PAGE_TRANSITION_FADECOLOR   1024

//////////////////////////////////////////////////////////////////////////////
// #FontWork#
#define CTF_FONTWORK_STYLE              1021
#define CTF_FONTWORK_ADJUST             1022
#define CTF_FONTWORK_DISTANCE           1023
#define CTF_FONTWORK_START              1024
#define CTF_FONTWORK_MIRROR             1025
#define CTF_FONTWORK_OUTLINE            1026
#define CTF_FONTWORK_SHADOW             1027
#define CTF_FONTWORK_SHADOWCOLOR        1028
#define CTF_FONTWORK_SHADOWOFFSETX      1029
#define CTF_FONTWORK_SHADOWOFFSETY      1030
#define CTF_FONTWORK_FORM               1031
#define CTF_FONTWORK_HIDEFORM           1032
#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033

//////////////////////////////////////////////////////////////////////////////
// OLE part 1
#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT     1040
#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP      1041
#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH    1042
#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT   1043
#define CTF_SD_OLE_ISINTERNAL               1044

#define CTF_SD_MOVE_PROTECT             1045
#define CTF_SD_SIZE_PROTECT             1046

//////////////////////////////////////////////////////////////////////////////
// caption
#define CTF_CAPTION_ISESCREL            1047
#define CTF_CAPTION_ESCREL              1048
#define CTF_CAPTION_ESCABS              1049

//////////////////////////////////////////////////////////////////////////////
// header&footer
#define CTF_HEADER_VISIBLE              1050
#define CTF_FOOTER_VISIBLE              1051
#define CTF_PAGE_NUMBER_VISIBLE         1052
#define CTF_DATE_TIME_VISIBLE           1053
#define CTF_HEADER_TEXT                 1054
#define CTF_FOOTER_TEXT                 1055
#define CTF_DATE_TIME_TEXT              1056
#define CTF_DATE_TIME_FORMAT            1057
#define CTF_DATE_TIME_UPDATE            1058

//////////////////////////////////////////////////////////////////////////////
// OLE part 2
#define CTF_SD_OLE_ASPECT                   1059
#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT     1060
#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP      1061
#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH    1062
#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT   1063

//////////////////////////////////////////////////////////////////////////////

#endif  // _XMLSDTYPES_HXX

//////////////////////////////////////////////////////////////////////////////
// eof
diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx
index f9e437d..ad76b43 100644
--- a/xmloff/source/draw/XMLShapeStyleContext.cxx
+++ b/xmloff/source/draw/XMLShapeStyleContext.cxx
@@ -66,7 +66,7 @@ XMLShapeStyleContext::XMLShapeStyleContext(
    sal_uInt16 nFamily)
:   XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ),
    m_bIsNumRuleAlreadyConverted( sal_False ),
    m_bIsFillStyleAlreadyConverted( sal_False ) //UUUU
    m_bIsFillStyleAlreadyConverted(false) //UUUU
{
}

@@ -198,80 +198,18 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet
        }
    }

    //UUUU need to filter out old fill definitions when the new ones are used. The new
    // ones are used when a FillStyle is defined
    if(!m_bIsFillStyleAlreadyConverted && GetProperties().size())
    {
        const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
        ::std::vector< XMLPropertyState >& rProperties = GetProperties();
        ::std::vector< XMLPropertyState >::iterator a;
        FillStyle eFS(FillStyle_NONE);
        static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));

        // try to find a FillStyle entry and a value from it
        for(a = rProperties.begin(); a != rProperties.end(); a++)
        if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
        {
            if(a->mnIndex != -1)
            {
                const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);

                if(rPropName == s_FillStyle)
                {
                    if(a->maValue >>= eFS)
                    {
                        // okay, type was good, eFS is set
                    }
                    else
                    {
                        // also try an int (see XFillStyleItem::PutValue)
                        sal_Int32 nFS = 0;

                        if(a->maValue >>= nFS)
                        {
                            eFS = (FillStyle)nFS;
                        }
                    }

                    // exit loop, we found out what we needed to know
                    break;
                }
            }
            deactivateOldFillStyleDefinitions(getStandardSet());
        }

        if(FillStyle_NONE != eFS)
        {
            //UUUU a FillStyle was found, thus the new [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
            // description for the Fill definitions is used. All formally used props based
            // on RES_BACKGROUND need to be deleted to get no conflicts between the two
            // sets of properties; old files will keep these and adapt accordingly
            static ::rtl::OUString s_BackColorRGB(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB"));
            static ::rtl::OUString s_BackTransparent(RTL_CONSTASCII_USTRINGPARAM("BackTransparent"));
            static ::rtl::OUString s_BackColorTransparency(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency"));
            static ::rtl::OUString s_BackGraphicURL(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL"));
            static ::rtl::OUString s_BackGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter"));
            static ::rtl::OUString s_BackGraphicLocation(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation"));
            static ::rtl::OUString s_BackGraphicTransparency(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency"));

            for(a = rProperties.begin(); a != rProperties.end(); a++)
            {
                if(a->mnIndex != -1)
                {
                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);

                    if(s_BackColorRGB == rPropName
                        || s_BackTransparent == rPropName
                        || s_BackColorTransparency == rPropName
                        || s_BackGraphicURL == rPropName
                        || s_BackGraphicFilter == rPropName
                        || s_BackGraphicLocation == rPropName
                        || s_BackGraphicTransparency== rPropName)
                    {
                        // mark entry as inactive
                        a->mnIndex = -1;
                    }
                }
            }
        }

        m_bIsFillStyleAlreadyConverted = sal_True;
        m_bIsFillStyleAlreadyConverted = true;
    }

    struct _ContextID_Index_Pair aContextIDs[] =
diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx
index b5befc3..2bc469a 100644
--- a/xmloff/source/draw/sdpropls.hxx
+++ b/xmloff/source/draw/sdpropls.hxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



#ifndef _SDPROPLS_HXX
#define _SDPROPLS_HXX

@@ -33,6 +31,7 @@
#include <xmloff/xmlprmap.hxx>
#include "xmloff/XMLTextListAutoStylePool.hxx"
#include <xmloff/xmlexppr.hxx>
#include <xmlsdtypes.hxx>

//////////////////////////////////////////////////////////////////////////////
// entry list for graphic properties
@@ -46,176 +45,6 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps[];
extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[];

//////////////////////////////////////////////////////////////////////////////
// types of own properties

#define XML_SD_TYPE_STROKE                          (XML_SD_TYPES_START +  0)
#define XML_SD_TYPE_PRESPAGE_TYPE                   (XML_SD_TYPES_START +  1)
#define XML_SD_TYPE_PRESPAGE_STYLE                  (XML_SD_TYPES_START +  2)
#define XML_SD_TYPE_PRESPAGE_SPEED                  (XML_SD_TYPES_START +  3)
#define XML_SD_TYPE_PRESPAGE_DURATION               (XML_SD_TYPES_START +  4)
#define XML_SD_TYPE_PRESPAGE_VISIBILITY             (XML_SD_TYPES_START +  5)
#define XML_SD_TYPE_MARKER                          (XML_SD_TYPES_START +  6 )
#define XML_SD_TYPE_OPACITY                         (XML_SD_TYPES_START +  7 )
#define XML_SD_TYPE_LINEJOIN                        (XML_SD_TYPES_START +  8 )
#define XML_SD_TYPE_FILLSTYLE                       (XML_SD_TYPES_START +  9 )
#define XML_SD_TYPE_GRADIENT                        (XML_SD_TYPES_START + 10 )
#define XML_SD_TYPE_GRADIENT_STEPCOUNT              (XML_SD_TYPES_START + 11 )
#define XML_SD_TYPE_SHADOW                          (XML_SD_TYPES_START + 12 )
#define XML_SD_TYPE_TEXT_CROSSEDOUT                 (XML_SD_TYPES_START + 13 )
#define XML_SD_TYPE_NUMBULLET                       (XML_SD_TYPES_START + 14 )
#define XML_SD_TYPE_WRITINGMODE                     (XML_SD_TYPES_START + 15 )
#define XML_SD_TYPE_BITMAP_MODE                     (XML_SD_TYPES_START + 16 )
#define XML_SD_TYPE_BITMAPREPOFFSETX                (XML_SD_TYPES_START + 17 )
#define XML_SD_TYPE_BITMAPREPOFFSETY                (XML_SD_TYPES_START + 18 )
#define XML_SD_TYPE_FILLBITMAPSIZE                  (XML_SD_TYPES_START + 19 )
#define XML_SD_TYPE_LOGICAL_SIZE                    (XML_SD_TYPES_START + 20 )
#define XML_SD_TYPE_BITMAP_REFPOINT                 (XML_SD_TYPES_START + 21 )
#define XML_SD_TYPE_PRESPAGE_BACKSIZE               (XML_SD_TYPES_START + 22 )
#define XML_TYPE_TEXT_ANIMATION_BLINKING            (XML_SD_TYPES_START + 23 )
#define XML_TYPE_TEXT_ANIMATION_STEPS               (XML_SD_TYPES_START + 24 )
#define XML_SD_TYPE_TEXT_ALIGN                      (XML_SD_TYPES_START + 25 )
#define XML_SD_TYPE_VERTICAL_ALIGN                  (XML_SD_TYPES_START + 26 )
#define XML_SD_TYPE_FITTOSIZE                       (XML_SD_TYPES_START + 27 )
#define XML_SD_TYPE_MEASURE_HALIGN                  (XML_SD_TYPES_START + 28 )
#define XML_SD_TYPE_MEASURE_VALIGN                  (XML_SD_TYPES_START + 29 )
#define XML_SD_TYPE_MEASURE_UNIT                    (XML_SD_TYPES_START + 30 )
#define XML_SD_TYPE_MEASURE_PLACING                 (XML_SD_TYPES_START + 31 )
#define XML_SD_TYPE_CONTROL_BORDER                  (XML_SD_TYPES_START + 32 )
#define XML_SD_TYPE_CONTROL_BORDER_COLOR            (XML_SD_TYPES_START + 33 )
#define XML_SD_TYPE_IMAGE_SCALE_MODE                (XML_SD_TYPES_START + 34 )
#define XML_SD_TYPE_LINECAP                         (XML_SD_TYPES_START + 35 )

// 3D property types
#define XML_SD_TYPE_BACKFACE_CULLING                (XML_SD_TYPES_START + 40 )
#define XML_SD_TYPE_NORMALS_KIND                    (XML_SD_TYPES_START + 41 )
#define XML_SD_TYPE_NORMALS_DIRECTION               (XML_SD_TYPES_START + 42 )
#define XML_SD_TYPE_TEX_GENERATION_MODE_X           (XML_SD_TYPES_START + 43 )
#define XML_SD_TYPE_TEX_GENERATION_MODE_Y           (XML_SD_TYPES_START + 44 )
#define XML_SD_TYPE_TEX_KIND                        (XML_SD_TYPES_START + 45 )
#define XML_SD_TYPE_TEX_MODE                        (XML_SD_TYPES_START + 46 )

//////////////////////////////////////////////////////////////////////////////
// #FontWork# types
#define XML_SD_TYPE_FONTWORK_STYLE                  (XML_SD_TYPES_START + 47 )
#define XML_SD_TYPE_FONTWORK_ADJUST                 (XML_SD_TYPES_START + 48 )
#define XML_SD_TYPE_FONTWORK_SHADOW                 (XML_SD_TYPES_START + 49 )
#define XML_SD_TYPE_FONTWORK_FORM                   (XML_SD_TYPES_START + 50 )

//////////////////////////////////////////////////////////////////////////////
// Caption types
#define XML_SD_TYPE_CAPTION_ANGLE_TYPE              (XML_SD_TYPES_START + 60 )
#define XML_SD_TYPE_CAPTION_IS_ESC_REL              (XML_SD_TYPES_START + 61 )
#define XML_SD_TYPE_CAPTION_ESC_REL                 (XML_SD_TYPES_START + 62 )
#define XML_SD_TYPE_CAPTION_ESC_ABS                 (XML_SD_TYPES_START + 63 )
#define XML_SD_TYPE_CAPTION_ESC_DIR                 (XML_SD_TYPES_START + 64 )
#define XML_SD_TYPE_CAPTION_TYPE                    (XML_SD_TYPES_START + 65 )

//////////////////////////////////////////////////////////////////////////////
// header & footer types
#define XML_SD_TYPE_DATETIMEUPDATE                  (XML_SD_TYPES_START + 70 )
#define XML_SD_TYPE_DATETIME_FORMAT                 (XML_SD_TYPES_START + 71 )

//////////////////////////////////////////////////////////////////////////////

// new types for merged style:protect attribute
#define XML_SD_TYPE_MOVE_PROTECT                    (XML_SD_TYPES_START + 72 )
#define XML_SD_TYPE_SIZE_PROTECT                    (XML_SD_TYPES_START + 73 )

// new type for style:mirror attribute
#define XML_TYPE_SD_MIRROR                          (XML_SD_TYPES_START + 74 )

//////////////////////////////////////////////////////////////////////////////

// new smil transition types for pages
#define XML_SD_TYPE_TRANSITION_TYPE                 (XML_SD_TYPES_START + 75 )
#define XML_SD_TYPE_TRANSTIION_SUBTYPE              (XML_SD_TYPES_START + 76 )
#define XML_SD_TYPE_TRANSTIION_DIRECTION            (XML_SD_TYPES_START + 77 )

#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE   (XML_SD_TYPES_START + 78 )

//////////////////////////////////////////////////////////////////////////////

#define CTF_NUMBERINGRULES          1000
#define CTF_CONTROLWRITINGMODE      1001
#define CTF_WRITINGMODE             1002
#define CTF_REPEAT_OFFSET_X         1003
#define CTF_REPEAT_OFFSET_Y         1004
#define CTF_PAGE_SOUND_URL          1005
#define CTF_PAGE_VISIBLE            1006
#define CTF_PAGE_TRANS_TYPE         1007
#define CTF_PAGE_TRANS_STYLE        1008
#define CTF_PAGE_TRANS_SPEED        1009
#define CTF_PAGE_TRANS_DURATION     1010
#define CTF_PAGE_BACKSIZE           1011
#define CTF_DASHNAME                1012
#define CTF_LINESTARTNAME           1013
#define CTF_LINEENDNAME             1014
#define CTF_FILLGRADIENTNAME        1015
#define CTF_FILLHATCHNAME           1016
#define CTF_FILLBITMAPNAME          1017
#define CTF_FILLTRANSNAME           1018
#define CTF_TEXTANIMATION_BLINKING  1019
#define CTF_TEXTANIMATION_KIND      1020

#define CTF_PAGE_TRANSITION_TYPE        1021
#define CTF_PAGE_TRANSITION_SUBTYPE     1022
#define CTF_PAGE_TRANSITION_DIRECTION   1023
#define CTF_PAGE_TRANSITION_FADECOLOR   1024

//////////////////////////////////////////////////////////////////////////////
// #FontWork#
#define CTF_FONTWORK_STYLE              1021
#define CTF_FONTWORK_ADJUST             1022
#define CTF_FONTWORK_DISTANCE           1023
#define CTF_FONTWORK_START              1024
#define CTF_FONTWORK_MIRROR             1025
#define CTF_FONTWORK_OUTLINE            1026
#define CTF_FONTWORK_SHADOW             1027
#define CTF_FONTWORK_SHADOWCOLOR        1028
#define CTF_FONTWORK_SHADOWOFFSETX      1029
#define CTF_FONTWORK_SHADOWOFFSETY      1030
#define CTF_FONTWORK_FORM               1031
#define CTF_FONTWORK_HIDEFORM           1032
#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033

//////////////////////////////////////////////////////////////////////////////
// OLE part 1
#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT     1040
#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP      1041
#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH    1042
#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT   1043
#define CTF_SD_OLE_ISINTERNAL               1044

#define CTF_SD_MOVE_PROTECT             1045
#define CTF_SD_SIZE_PROTECT             1046

//////////////////////////////////////////////////////////////////////////////
// caption
#define CTF_CAPTION_ISESCREL            1047
#define CTF_CAPTION_ESCREL              1048
#define CTF_CAPTION_ESCABS              1049

//////////////////////////////////////////////////////////////////////////////
// header&footer
#define CTF_HEADER_VISIBLE              1050
#define CTF_FOOTER_VISIBLE              1051
#define CTF_PAGE_NUMBER_VISIBLE         1052
#define CTF_DATE_TIME_VISIBLE           1053
#define CTF_HEADER_TEXT                 1054
#define CTF_FOOTER_TEXT                 1055
#define CTF_DATE_TIME_TEXT              1056
#define CTF_DATE_TIME_FORMAT            1057
#define CTF_DATE_TIME_UPDATE            1058

//////////////////////////////////////////////////////////////////////////////
// OLE part 2
#define CTF_SD_OLE_ASPECT                   1059
#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT     1060
#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP      1061
#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH    1062
#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT   1063

//////////////////////////////////////////////////////////////////////////////
// enum maps for attributes

extern SvXMLEnumMapEntry aXML_ConnectionKind_EnumMap[];
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 199cb4b..ed7a74c 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -19,10 +19,9 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include "PageMasterExportPropMapper.hxx"
#include <xmloff/xmltoken.hxx>
#include <comphelper/types.hxx>
@@ -32,13 +31,15 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/extract.hxx>

//UUUU
#include <xmloff/txtprmap.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::comphelper;
using namespace ::xmloff::token;


//______________________________________________________________________________

inline sal_Bool lcl_HasSameLineWidth( const table::BorderLine& rLine1, const table::BorderLine& rLine2 )
@@ -339,6 +340,14 @@ void XMLPageMasterExportPropMapper::ContextFilter(

    XMLPropertyState*       pPrint              = NULL;

    //UUUU
    XMLPropertyState* pRepeatOffsetX = NULL;
    XMLPropertyState* pRepeatOffsetY = NULL;
    XMLPropertyState* pHeaderRepeatOffsetX = NULL;
    XMLPropertyState* pHeaderRepeatOffsetY = NULL;
    XMLPropertyState* pFooterRepeatOffsetX = NULL;
    XMLPropertyState* pFooterRepeatOffsetY = NULL;

    UniReference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());

    for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
@@ -396,7 +405,64 @@ void XMLPageMasterExportPropMapper::ContextFilter(
            case CTF_PM_STANDARD_MODE:      pPMStandardMode     = pProp;    break;
            case CTP_PM_GRID_BASE_WIDTH:        pPMGridBaseWidth    = pProp;    break;
            case CTP_PM_GRID_SNAP_TO_CHARS:     pPMGridSnapToChars  = pProp;    break;

            //UUUU
            case CTF_PM_REPEAT_OFFSET_X:
                pRepeatOffsetX = pProp;
                break;

            //UUUU
            case CTF_PM_REPEAT_OFFSET_Y:
                pRepeatOffsetY = pProp;
                break;

            //UUUU
            case CTF_PM_HEADERREPEAT_OFFSET_X:
                pHeaderRepeatOffsetX = pProp;
                break;

            //UUUU
            case CTF_PM_HEADERREPEAT_OFFSET_Y:
                pHeaderRepeatOffsetY = pProp;
                break;

            //UUUU
            case CTF_PM_FOOTERREPEAT_OFFSET_X:
                pFooterRepeatOffsetX = pProp;
                break;

            //UUUU
            case CTF_PM_FOOTERREPEAT_OFFSET_Y:
                pFooterRepeatOffsetY = pProp;
                break;

            //UUUU Sort out empty entries
            case CTF_PM_FILLGRADIENTNAME:
            case CTF_PM_FILLHATCHNAME:
            case CTF_PM_FILLBITMAPNAME:
            case CTF_PM_FILLTRANSNAME:

            case CTF_PM_HEADERFILLGRADIENTNAME:
            case CTF_PM_HEADERFILLHATCHNAME:
            case CTF_PM_HEADERFILLBITMAPNAME:
            case CTF_PM_HEADERFILLTRANSNAME:

            case CTF_PM_FOOTERFILLGRADIENTNAME:
            case CTF_PM_FOOTERFILLHATCHNAME:
            case CTF_PM_FOOTERFILLBITMAPNAME:
            case CTF_PM_FOOTERFILLTRANSNAME:
            {
                rtl::OUString aStr;

                if( (pProp->maValue >>= aStr) && 0 == aStr.getLength() )
                {
                    pProp->mnIndex = -1;
                }

                break;
            }
        }

        if (nPrintId == CTF_PM_PRINTMASK)
        {
            pPrint = pProp;
@@ -404,6 +470,54 @@ void XMLPageMasterExportPropMapper::ContextFilter(
        }
    }

    //UUUU These entries need to be reduced to a single one for XML export.
    // Both would be exported as 'draw:tile-repeat-offset' following a percent
    // value and a 'vertical' or 'horizontal' tag as mark. If both would be active
    // and both would be exported this would create an XML error (same property twice)
    if(pRepeatOffsetX && pRepeatOffsetY)
    {
        sal_Int32 nOffset(0);

        if((pRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
        {
            pRepeatOffsetX->mnIndex = -1;
        }
        else
        {
            pRepeatOffsetY->mnIndex = -1;
        }
    }

    //UUUU Same as above for Header
    if(pHeaderRepeatOffsetX && pHeaderRepeatOffsetY)
    {
        sal_Int32 nOffset(0);

        if((pHeaderRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
        {
            pHeaderRepeatOffsetX->mnIndex = -1;
        }
        else
        {
            pHeaderRepeatOffsetY->mnIndex = -1;
        }
    }

    //UUUU Same as above for Footer
    if(pFooterRepeatOffsetX && pFooterRepeatOffsetY)
    {
        sal_Int32 nOffset(0);

        if((pFooterRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
        {
            pFooterRepeatOffsetX->mnIndex = -1;
        }
        else
        {
            pFooterRepeatOffsetY->mnIndex = -1;
        }
    }

    if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) )
    {
        lcl_RemoveState(pPMStandardMode);
diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx
index 3902d32..c0dc7fd 100644
--- a/xmloff/source/style/PageMasterImportContext.cxx
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -19,34 +19,33 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"


#include "PageMasterImportContext.hxx"
#include "xmloff/xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
#include "PageMasterPropHdl.hxx"
#include "PagePropertySetContext.hxx"
#ifndef _XMLOFF_PAGEPHEADERFOOTERCONTEXT_HXX
#include "PageHeaderFooterContext.hxx"
#endif
#ifndef _XMLOFF_PAGEMASTERPROPMAPPER_HXX
#include "PageMasterPropMapper.hxx"
#endif
#include "PageMasterImportPropMapper.hxx"
#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
#include <xmloff/PageMasterStyleMap.hxx>
#endif
#include <com/sun/star/lang/XMultiServiceFactory.hpp>

//UUUU
#include <xmlsdtypes.hxx>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <xmloff/xmlerror.hxx>

using namespace ::com::sun::star;
using namespace ::xmloff::token;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;

//UUUU
using namespace ::com::sun::star::beans;

void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
                                        const rtl::OUString& rLocalName,
                                        const rtl::OUString& rValue )
@@ -70,7 +69,8 @@ PageStyleContext::PageStyleContext( SvXMLImport& rImport,
        SvXMLStylesContext& rStyles,
        sal_Bool bDefaultStyle) :
    XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_PAGE_MASTER, bDefaultStyle),
    sPageUsage()
    sPageUsage(),
    m_bIsFillStyleAlreadyConverted(false) //UUUU
{
}

@@ -167,10 +167,148 @@ SvXMLImportContext *PageStyleContext::CreateChildContext(
    return pContext;
}

void PageStyleContext::FillPropertySet(
            const uno::Reference<beans::XPropertySet > & rPropSet )
void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > & rPropSet)
{
    XMLPropStyleContext::FillPropertySet(rPropSet);
    //UUUU need to filter out old fill definitions when the new ones are used. The new
    // ones are used when a FillStyle is defined
    if(!m_bIsFillStyleAlreadyConverted && GetProperties().size())
    {
        static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
        static ::rtl::OUString s_HeaderFillStyle(RTL_CONSTASCII_USTRINGPARAM("HeaderFillStyle"));
        static ::rtl::OUString s_FooterFillStyle(RTL_CONSTASCII_USTRINGPARAM("FooterFillStyle"));

        if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
        {
            deactivateOldFillStyleDefinitions(getStandardSet());
        }

        if(doNewDrawingLayerFillStyleDefinitionsExist(s_HeaderFillStyle))
        {
            deactivateOldFillStyleDefinitions(getHeaderSet());
        }

        if(doNewDrawingLayerFillStyleDefinitionsExist(s_FooterFillStyle))
        {
            deactivateOldFillStyleDefinitions(getFooterSet());
        }

        m_bIsFillStyleAlreadyConverted = true;
    }

    //UUUU do not use XMLPropStyleContext::FillPropertySet, we need to handle this ourselves since
    // we have properties which use the MID_FLAG_NO_PROPERTY_IMPORT flag since they need some special
    // handling
    UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily());

    if(xImpPrMap.is())
    {
        // properties that need special handling because they need the used name to be translated first
        struct _ContextID_Index_Pair aContextIDs[] =
        {
            { CTF_PM_FILLGRADIENTNAME, -1 },
            { CTF_PM_FILLTRANSNAME, -1 },
            { CTF_PM_FILLHATCHNAME, -1 },
            { CTF_PM_FILLBITMAPNAME, -1 },

            // also need to special handling for header entries
            { CTF_PM_HEADERFILLGRADIENTNAME, -1 },
            { CTF_PM_HEADERFILLTRANSNAME, -1 },
            { CTF_PM_HEADERFILLHATCHNAME, -1 },
            { CTF_PM_HEADERFILLBITMAPNAME, -1 },

            // also need to special handling for footer entries
            { CTF_PM_FOOTERFILLGRADIENTNAME, -1 },
            { CTF_PM_FOOTERFILLTRANSNAME, -1 },
            { CTF_PM_FOOTERFILLHATCHNAME, -1 },
            { CTF_PM_FOOTERFILLBITMAPNAME, -1 },

            {-1, -1}
        };

        // the style families associated with the same index modulo 4
        static sal_uInt16 aFamilies[] =
        {
            XML_STYLE_FAMILY_SD_GRADIENT_ID,
            XML_STYLE_FAMILY_SD_GRADIENT_ID,
            XML_STYLE_FAMILY_SD_HATCH_ID,
            XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
        };

        //UUUU Fill PropertySet, but let it handle special properties not itself
        xImpPrMap->FillPropertySet(GetProperties(), rPropSet, aContextIDs);

        // get property set mapper
        const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
        Reference< XPropertySetInfo > xInfo;

        //UUUU handle special attributes which have MID_FLAG_NO_PROPERTY_IMPORT set
        for(sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++)
        {
            sal_Int32 nIndex = aContextIDs[i].nIndex;

            if(nIndex != -1)
            {
                switch(aContextIDs[i].nContextID)
                {
                    case CTF_PM_FILLGRADIENTNAME:
                    case CTF_PM_FILLTRANSNAME:
                    case CTF_PM_FILLHATCHNAME:
                    case CTF_PM_FILLBITMAPNAME:

                    case CTF_PM_HEADERFILLGRADIENTNAME:
                    case CTF_PM_HEADERFILLTRANSNAME:
                    case CTF_PM_HEADERFILLHATCHNAME:
                    case CTF_PM_HEADERFILLBITMAPNAME:

                    case CTF_PM_FOOTERFILLGRADIENTNAME:
                    case CTF_PM_FOOTERFILLTRANSNAME:
                    case CTF_PM_FOOTERFILLHATCHNAME:
                    case CTF_PM_FOOTERFILLBITMAPNAME:
                    {
                        struct XMLPropertyState& rState = GetProperties()[nIndex];
                        rtl::OUString sStyleName;
                        rState.maValue >>= sStyleName;

                        //UUUU translate the used name from ODF intern to the name used in the Model
                        sStyleName = GetImport().GetStyleDisplayName(aFamilies[i%4], sStyleName);

                        try
                        {
                            // set property
                            const rtl::OUString& rPropertyName = rMapper->GetEntryAPIName(rState.mnIndex);

                            if(!xInfo.is())
                            {
                                xInfo = rPropSet->getPropertySetInfo();
                            }

                            if(xInfo->hasPropertyByName(rPropertyName))
                            {
                                rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
                            }
                        }
                        catch(::com::sun::star::lang::IllegalArgumentException& e)
                        {
                            Sequence< rtl::OUString > aSeq(1);
                            aSeq[0] = sStyleName;
                            GetImport().SetError(
                                XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
                                aSeq,e.Message,NULL);
                        }
                        break;
                    }
                }
            }
        }
    }
    else
    {
        OSL_ENSURE(xImpPrMap.is(), "Got no SvXMLImportPropertyMapper (!)");
    }

    //UUUU old code, replaced by above stuff
    // XMLPropStyleContext::FillPropertySet(rPropSet);

    if (sPageUsage.getLength())
    {
        uno::Any aPageUsage;
@@ -195,3 +333,4 @@ void PageStyleContext::SetDefaults( )
    }
}

//eof
diff --git a/xmloff/source/style/PageMasterPropHdlFactory.cxx b/xmloff/source/style/PageMasterPropHdlFactory.cxx
index 12613bd..edc4fdd 100644
--- a/xmloff/source/style/PageMasterPropHdlFactory.cxx
+++ b/xmloff/source/style/PageMasterPropHdlFactory.cxx
@@ -19,32 +19,41 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include "PageMasterPropHdlFactory.hxx"
#include <xmloff/xmltypes.hxx>
#include <xmloff/xmltoken.hxx>
#include "xmlbahdl.hxx"
#include <xmloff/NamedBoolPropertyHdl.hxx>
#ifndef _XMLOFF_XMLTEXTCOLUMNSPPROPERTYHANDLER_HXX
#include "XMLTextColumnsPropertyHandler.hxx"
#endif
#include <xmloff/XMLConstantsPropertyHandler.hxx>
#include "PageMasterPropHdl.hxx"
#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
#include <xmloff/PageMasterStyleMap.hxx>
#endif
#include <com/sun/star/text/TextGridMode.hpp>

//UUUU
#include <xmloff/EnumPropertyHdl.hxx>
#include <com/sun/star/drawing/FillStyle.hpp>
#include "XMLFillBitmapSizePropertyHandler.hxx"
#include "XMLBitmapLogicalSizePropertyHandler.hxx"
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"

using ::rtl::OUString;
using ::rtl::OUStringBuffer;

using namespace ::xmloff::token;
using namespace ::com::sun::star;
//UUUU
using namespace ::com::sun::star::drawing;

//UUUU
extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];

SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
{
@@ -135,6 +144,34 @@ const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_I
                pHdl = new XMLConstantsPropertyHandler(
                    aXML_TextGridMode_ConstantMap, XML_NONE );
            break;

            //UUUU
            case XML_SW_TYPE_FILLSTYLE:
                pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) );
                break;
            case XML_SW_TYPE_FILLBITMAPSIZE:
                pHdl = new XMLFillBitmapSizePropertyHandler();
                break;
            case XML_SW_TYPE_LOGICAL_SIZE:
                pHdl = new XMLBitmapLogicalSizePropertyHandler();
                break;
            case XML_SW_TYPE_BITMAP_REFPOINT:
                pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) );
                break;
            case XML_SW_TYPE_BITMAP_MODE:
                pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) );
                break;
            case XML_SW_TYPE_BITMAPREPOFFSETX:
            case XML_SW_TYPE_BITMAPREPOFFSETY:
                pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
                break;

            //UUUU
            default:
            {
                OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
                break;
            }
        }

        if( pHdl )
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index e49e659..2aa7440 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -19,83 +19,88 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include <xmloff/PageMasterStyleMap.hxx>

#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>

//UUUU
#include <xmloff/txtprmap.hxx>

using namespace ::xmloff::token;

#define _MAP(name,prefix,token,type,context)  { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_010 }
#define PLMAP(name,prefix,token,type,context) \
        _MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
#define HFMAP(name,prefix,token,type,context) \
        _MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)
#define PLMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
#define HFMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)

//UUUU
#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context)

//______________________________________________________________________________

const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
{
// page master
    PLMAP( "PageStyleLayout",           XML_NAMESPACE_STYLE,    XML_PAGE_USAGE,                 XML_PM_TYPE_PAGESTYLELAYOUT | MID_FLAG_SPECIAL_ITEM,    CTF_PM_PAGEUSAGE ),
    PLMAP( "Width",                 XML_NAMESPACE_FO,       XML_PAGE_WIDTH,                 XML_TYPE_MEASURE,                                       0 ),
    PLMAP( "Height",                    XML_NAMESPACE_FO,       XML_PAGE_HEIGHT,                XML_TYPE_MEASURE,                                       0 ),
    PLMAP( "NumberingType",         XML_NAMESPACE_STYLE,    XML_NUM_FORMAT,                 XML_PM_TYPE_NUMFORMAT | MID_FLAG_MERGE_PROPERTY,        0 ),
    PLMAP( "NumberingType",         XML_NAMESPACE_STYLE,    XML_NUM_LETTER_SYNC,            XML_PM_TYPE_NUMLETTERSYNC,                              0 ),
    PLMAP( "PrinterPaperTray",      XML_NAMESPACE_STYLE,    XML_PAPER_TRAY_NAME,            XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT,         0 ),
    PLMAP( "IsLandscape",               XML_NAMESPACE_STYLE,    XML_PRINT_ORIENTATION,          XML_PM_TYPE_PRINTORIENTATION,                           0 ),
    PLMAP( "TopMargin",             XML_NAMESPACE_FO,       XML_MARGIN,                     XML_TYPE_MEASURE,                                       CTF_PM_MARGINALL ),
    PLMAP( "TopMargin",             XML_NAMESPACE_FO,       XML_MARGIN_TOP,                 XML_TYPE_MEASURE,                                       CTF_PM_MARGINTOP ),
    PLMAP( "BottomMargin",          XML_NAMESPACE_FO,       XML_MARGIN_BOTTOM,              XML_TYPE_MEASURE,                                       CTF_PM_MARGINBOTTOM ),
    PLMAP( "LeftMargin",                XML_NAMESPACE_FO,       XML_MARGIN_LEFT,                XML_TYPE_MEASURE,                                       CTF_PM_MARGINLEFT ),
    PLMAP( "RightMargin",               XML_NAMESPACE_FO,       XML_MARGIN_RIGHT,               XML_TYPE_MEASURE,                                       CTF_PM_MARGINRIGHT ),
    PLMAP( "TopBorder",             XML_NAMESPACE_FO,       XML_BORDER,                     XML_TYPE_BORDER,                                        CTF_PM_BORDERALL ),
    PLMAP( "TopBorder",             XML_NAMESPACE_FO,       XML_BORDER_TOP,                 XML_TYPE_BORDER,                                        CTF_PM_BORDERTOP ),
    PLMAP( "BottomBorder",          XML_NAMESPACE_FO,       XML_BORDER_BOTTOM,              XML_TYPE_BORDER,                                        CTF_PM_BORDERBOTTOM ),
    PLMAP( "LeftBorder",                XML_NAMESPACE_FO,       XML_BORDER_LEFT,                XML_TYPE_BORDER,                                        CTF_PM_BORDERLEFT ),
    PLMAP( "RightBorder",               XML_NAMESPACE_FO,       XML_BORDER_RIGHT,               XML_TYPE_BORDER,                                        CTF_PM_BORDERRIGHT ),
    PLMAP( "TopBorder",             XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,          XML_TYPE_BORDER_WIDTH,                                  CTF_PM_BORDERWIDTHALL ),
    PLMAP( "TopBorder",             XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,      XML_TYPE_BORDER_WIDTH,                                  CTF_PM_BORDERWIDTHTOP ),
    PLMAP( "BottomBorder",          XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,   XML_TYPE_BORDER_WIDTH,                                  CTF_PM_BORDERWIDTHBOTTOM ),
    PLMAP( "LeftBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,                                  CTF_PM_BORDERWIDTHLEFT ),
    PLMAP( "RightBorder",               XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,                                  CTF_PM_BORDERWIDTHRIGHT ),
    PLMAP( "TopBorderDistance",     XML_NAMESPACE_FO,       XML_PADDING,                    XML_TYPE_MEASURE,                                       CTF_PM_PADDINGALL ),
    PLMAP( "TopBorderDistance",     XML_NAMESPACE_FO,       XML_PADDING_TOP,                XML_TYPE_MEASURE,                                       CTF_PM_PADDINGTOP ),
    PLMAP( "BottomBorderDistance",  XML_NAMESPACE_FO,       XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,                                       CTF_PM_PADDINGBOTTOM ),
    PLMAP( "LeftBorderDistance",        XML_NAMESPACE_FO,       XML_PADDING_LEFT,               XML_TYPE_MEASURE,                                       CTF_PM_PADDINGLEFT ),
    PLMAP( "RightBorderDistance",   XML_NAMESPACE_FO,       XML_PADDING_RIGHT,              XML_TYPE_MEASURE,                                       CTF_PM_PADDINGRIGHT ),
    PLMAP( "ShadowFormat",          XML_NAMESPACE_STYLE,    XML_SHADOW,                     XML_TYPE_TEXT_SHADOW,                                   0 ),
    PLMAP( "BackColor",             XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    0 ),
    PLMAP( "BackTransparent",           XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,      0 ),
    PLMAP( "BackGraphicLocation",       XML_NAMESPACE_STYLE,    XML_POSITION,                   XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,      CTF_PM_GRAPHICPOSITION ),
    PLMAP( "BackGraphicFilter",     XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_GRAPHICFILTER ),
    PLMAP( "BackGraphicURL",            XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,           XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_GRAPHICURL ),
    PLMAP( "PrintAnnotations",      XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTANNOTATIONS | MID_FLAG_MULTI_PROPERTY,                         CTF_PM_PRINT_ANNOTATIONS ),
    PLMAP( "PrintCharts",               XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTCHARTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,   CTF_PM_PRINT_CHARTS ),
    PLMAP( "PrintDrawing",          XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTDRAWING | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,  CTF_PM_PRINT_DRAWING ),
    PLMAP( "PrintFormulas",         XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTFORMULAS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_FORMULAS ),
    PLMAP( "PrintGrid",             XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTGRID | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,     CTF_PM_PRINT_GRID ),
    PLMAP( "PrintHeaders",          XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTHEADERS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,  CTF_PM_PRINT_HEADERS ),
    PLMAP( "PrintObjects",          XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTOBJECTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,  CTF_PM_PRINT_OBJECTS ),
    PLMAP( "PrintZeroValues",           XML_NAMESPACE_STYLE,    XML_PRINT,                      XML_PM_TYPE_PRINTZEROVALUES | MID_FLAG_MERGE_ATTRIBUTE,                         CTF_PM_PRINT_ZEROVALUES ),
    PLMAP( "PrintDownFirst",            XML_NAMESPACE_STYLE,    XML_PRINT_PAGE_ORDER,           XML_PM_TYPE_PRINTPAGEORDER,                             0 ),
    PLMAP( "FirstPageNumber",           XML_NAMESPACE_STYLE,    XML_FIRST_PAGE_NUMBER,          XML_PM_TYPE_FIRSTPAGENUMBER,                            0 ),
    PLMAP( "PageScale",             XML_NAMESPACE_STYLE,    XML_SCALE_TO,                   XML_TYPE_PERCENT16,                                     CTF_PM_SCALETO ),
    PLMAP( "ScaleToPages",          XML_NAMESPACE_STYLE,    XML_SCALE_TO_PAGES,             XML_TYPE_NUMBER16,                                      CTF_PM_SCALETOPAGES ),
    PLMAP( "ScaleToPagesX",         XML_NAMESPACE_STYLE,    XML_SCALE_TO_X,                 XML_TYPE_NUMBER16,                                      CTF_PM_SCALETOX ),
    PLMAP( "ScaleToPagesY",         XML_NAMESPACE_STYLE,    XML_SCALE_TO_Y,                 XML_TYPE_NUMBER16,                                      CTF_PM_SCALETOY ),
    //////////////////////////////////////////////////////////////////////////
    //UUUU Section for 'page-layout-properties'

    // page master
    PLMAP( "PageStyleLayout",            XML_NAMESPACE_STYLE,    XML_PAGE_USAGE,                    XML_PM_TYPE_PAGESTYLELAYOUT | MID_FLAG_SPECIAL_ITEM,    CTF_PM_PAGEUSAGE ),
    PLMAP( "Width",                    XML_NAMESPACE_FO,        XML_PAGE_WIDTH,                    XML_TYPE_MEASURE,                                        0 ),
    PLMAP( "Height",                    XML_NAMESPACE_FO,        XML_PAGE_HEIGHT,                XML_TYPE_MEASURE,                                        0 ),
    PLMAP( "NumberingType",            XML_NAMESPACE_STYLE,    XML_NUM_FORMAT,                    XML_PM_TYPE_NUMFORMAT | MID_FLAG_MERGE_PROPERTY,        0 ),
    PLMAP( "NumberingType",            XML_NAMESPACE_STYLE,    XML_NUM_LETTER_SYNC,            XML_PM_TYPE_NUMLETTERSYNC,                                0 ),
    PLMAP( "PrinterPaperTray",        XML_NAMESPACE_STYLE,    XML_PAPER_TRAY_NAME,            XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT,         0 ),
    PLMAP( "IsLandscape",                XML_NAMESPACE_STYLE,    XML_PRINT_ORIENTATION,            XML_PM_TYPE_PRINTORIENTATION,                            0 ),
    PLMAP( "TopMargin",                XML_NAMESPACE_FO,        XML_MARGIN,                        XML_TYPE_MEASURE,                                        CTF_PM_MARGINALL ),
    PLMAP( "TopMargin",                XML_NAMESPACE_FO,        XML_MARGIN_TOP,                    XML_TYPE_MEASURE,                                        CTF_PM_MARGINTOP ),
    PLMAP( "BottomMargin",            XML_NAMESPACE_FO,        XML_MARGIN_BOTTOM,                XML_TYPE_MEASURE,                                        CTF_PM_MARGINBOTTOM ),
    PLMAP( "LeftMargin",                XML_NAMESPACE_FO,        XML_MARGIN_LEFT,                XML_TYPE_MEASURE,                                        CTF_PM_MARGINLEFT ),
    PLMAP( "RightMargin",                XML_NAMESPACE_FO,        XML_MARGIN_RIGHT,                XML_TYPE_MEASURE,                                        CTF_PM_MARGINRIGHT ),
    PLMAP( "TopBorder",                XML_NAMESPACE_FO,        XML_BORDER,                     XML_TYPE_BORDER,                                        CTF_PM_BORDERALL ),
    PLMAP( "TopBorder",                XML_NAMESPACE_FO,        XML_BORDER_TOP,                    XML_TYPE_BORDER,                                        CTF_PM_BORDERTOP ),
    PLMAP( "BottomBorder",            XML_NAMESPACE_FO,        XML_BORDER_BOTTOM,                XML_TYPE_BORDER,                                        CTF_PM_BORDERBOTTOM ),
    PLMAP( "LeftBorder",                XML_NAMESPACE_FO,        XML_BORDER_LEFT,                XML_TYPE_BORDER,                                        CTF_PM_BORDERLEFT ),
    PLMAP( "RightBorder",                XML_NAMESPACE_FO,        XML_BORDER_RIGHT,                XML_TYPE_BORDER,                                        CTF_PM_BORDERRIGHT ),
    PLMAP( "TopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,            XML_TYPE_BORDER_WIDTH,                                    CTF_PM_BORDERWIDTHALL ),
    PLMAP( "TopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,        XML_TYPE_BORDER_WIDTH,                                    CTF_PM_BORDERWIDTHTOP ),
    PLMAP( "BottomBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,    XML_TYPE_BORDER_WIDTH,                                    CTF_PM_BORDERWIDTHBOTTOM ),
    PLMAP( "LeftBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,                                    CTF_PM_BORDERWIDTHLEFT ),
    PLMAP( "RightBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,                                    CTF_PM_BORDERWIDTHRIGHT ),
    PLMAP( "TopBorderDistance",        XML_NAMESPACE_FO,        XML_PADDING,                    XML_TYPE_MEASURE,                                        CTF_PM_PADDINGALL ),
    PLMAP( "TopBorderDistance",        XML_NAMESPACE_FO,        XML_PADDING_TOP,                XML_TYPE_MEASURE,                                        CTF_PM_PADDINGTOP ),
    PLMAP( "BottomBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,                                        CTF_PM_PADDINGBOTTOM ),
    PLMAP( "LeftBorderDistance",        XML_NAMESPACE_FO,        XML_PADDING_LEFT,                XML_TYPE_MEASURE,                                        CTF_PM_PADDINGLEFT ),
    PLMAP( "RightBorderDistance",     XML_NAMESPACE_FO,        XML_PADDING_RIGHT,                XML_TYPE_MEASURE,                                        CTF_PM_PADDINGRIGHT ),
    PLMAP( "ShadowFormat",            XML_NAMESPACE_STYLE,    XML_SHADOW,                        XML_TYPE_TEXT_SHADOW,                                    0 ),
    PLMAP( "BackColor",                XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    0 ),
    PLMAP( "BackTransparent",            XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,        0 ),
    PLMAP( "BackGraphicLocation",        XML_NAMESPACE_STYLE,    XML_POSITION,                    XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,        CTF_PM_GRAPHICPOSITION ),
    PLMAP( "BackGraphicFilter",        XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_GRAPHICFILTER ),
    PLMAP( "BackGraphicURL",            XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,            XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_GRAPHICURL ),
    PLMAP( "PrintAnnotations",        XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTANNOTATIONS | MID_FLAG_MULTI_PROPERTY,                            CTF_PM_PRINT_ANNOTATIONS ),
    PLMAP( "PrintCharts",                XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTCHARTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,    CTF_PM_PRINT_CHARTS ),
    PLMAP( "PrintDrawing",            XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTDRAWING | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,    CTF_PM_PRINT_DRAWING ),
    PLMAP( "PrintFormulas",            XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTFORMULAS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,    CTF_PM_PRINT_FORMULAS ),
    PLMAP( "PrintGrid",                XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTGRID | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,        CTF_PM_PRINT_GRID ),
    PLMAP( "PrintHeaders",            XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTHEADERS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,    CTF_PM_PRINT_HEADERS ),
    PLMAP( "PrintObjects",            XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTOBJECTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE,    CTF_PM_PRINT_OBJECTS ),
    PLMAP( "PrintZeroValues",            XML_NAMESPACE_STYLE,    XML_PRINT,                        XML_PM_TYPE_PRINTZEROVALUES | MID_FLAG_MERGE_ATTRIBUTE,                            CTF_PM_PRINT_ZEROVALUES ),
    PLMAP( "PrintDownFirst",            XML_NAMESPACE_STYLE,    XML_PRINT_PAGE_ORDER,            XML_PM_TYPE_PRINTPAGEORDER,                                0 ),
    PLMAP( "FirstPageNumber",            XML_NAMESPACE_STYLE,    XML_FIRST_PAGE_NUMBER,            XML_PM_TYPE_FIRSTPAGENUMBER,                            0 ),
    PLMAP( "PageScale",                XML_NAMESPACE_STYLE,    XML_SCALE_TO,                    XML_TYPE_PERCENT16,                                        CTF_PM_SCALETO ),
    PLMAP( "ScaleToPages",            XML_NAMESPACE_STYLE,    XML_SCALE_TO_PAGES,             XML_TYPE_NUMBER16,                                        CTF_PM_SCALETOPAGES ),
    PLMAP( "ScaleToPagesX",            XML_NAMESPACE_STYLE,    XML_SCALE_TO_X,                  XML_TYPE_NUMBER16,                                        CTF_PM_SCALETOX ),
    PLMAP( "ScaleToPagesY",            XML_NAMESPACE_STYLE,    XML_SCALE_TO_Y,                 XML_TYPE_NUMBER16,                                        CTF_PM_SCALETOY ),
    PLMAP( "CenterHorizontally",        XML_NAMESPACE_STYLE,    XML_TABLE_CENTERING,            XML_PM_TYPE_CENTER_HORIZONTAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
    PLMAP( "CenterVertically",      XML_NAMESPACE_STYLE,    XML_TABLE_CENTERING,            XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
    PLMAP( "TextColumns",               XML_NAMESPACE_STYLE,    XML_COLUMNS,    MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ),
    PLMAP( "RegisterModeActive",        XML_NAMESPACE_STYLE,    XML_REGISTER_TRUE,  XML_TYPE_BOOL, 0 ),
    PLMAP( "RegisterParagraphStyle",    XML_NAMESPACE_STYLE,    XML_REGISTER_TRUTH_REF_STYLE_NAME,  XML_TYPE_STYLENAME| MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_PM_REGISTER_STYLE ),
    PLMAP( "CenterVertically",        XML_NAMESPACE_STYLE,    XML_TABLE_CENTERING,            XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
    PLMAP( "TextColumns",                XML_NAMESPACE_STYLE,    XML_COLUMNS,    MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ),
    PLMAP( "RegisterModeActive",        XML_NAMESPACE_STYLE,    XML_REGISTER_TRUE,    XML_TYPE_BOOL, 0 ),
    PLMAP( "RegisterParagraphStyle",    XML_NAMESPACE_STYLE,    XML_REGISTER_TRUTH_REF_STYLE_NAME,    XML_TYPE_STYLENAME| MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_PM_REGISTER_STYLE ),
    PLMAP( "WritingMode",                 XML_NAMESPACE_STYLE,    XML_WRITING_MODE,               XML_TYPE_TEXT_WRITING_MODE, 0 ),

    // Index 53: Grid definitions
    PLMAP( "GridColor", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_COLOR, XML_TYPE_COLOR, 0 ),
    PLMAP( "GridLines", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_LINES, XML_TYPE_NUMBER16, 0 ),
    PLMAP( "GridBaseHeight", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_TYPE_MEASURE, 0 ),
@@ -111,79 +116,158 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
      //export as a default attribute
    PLMAP( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ),

    PLMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT,     XML_XMLNS,                      XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
    PLMAP( "UserDefinedAttributes",    XML_NAMESPACE_TEXT,        XML_XMLNS,                        XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),

// footnote
    //UUUUIndex 65: fill attributes; use PLMAP macro here instead of GMAP, tis list is ordered and it's order is used
    // to decide in which section in ODF to export the contained stuff (the PageMasterStyle creates several XML
    // sections, for Page, Header and Footer). The needed order seems to rely not on filtering, but using sections
    // based on the order used in this list.
    // Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of
    // CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the
    // 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER
    PLMAP( "FillStyle",                     XML_NAMESPACE_DRAW,     XML_FILL,                   XML_SW_TYPE_FILLSTYLE,                                  0 ),
    PLMAP( "FillColor",                     XML_NAMESPACE_DRAW,     XML_FILL_COLOR,             XML_TYPE_COLOR,                                         0 ),
    PLMAP( "FillColor2",                    XML_NAMESPACE_DRAW,     XML_SECONDARY_FILL_COLOR,   XML_TYPE_COLOR,                                         0 ),
    PLMAP( "FillGradientName",              XML_NAMESPACE_DRAW,     XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FILLGRADIENTNAME ),
    PLMAP( "FillGradientStepCount",         XML_NAMESPACE_DRAW,     XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16,                                      0 ),
    PLMAP( "FillHatchName",                 XML_NAMESPACE_DRAW,     XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FILLHATCHNAME ),
    PLMAP( "FillBackground",                XML_NAMESPACE_DRAW,     XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL,                                          0 ),
    PLMAP( "FillBitmapName",                XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FILLBITMAPNAME ),
    PLMAP( "FillTransparence",              XML_NAMESPACE_DRAW,     XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY,         0 ),    // exists in SW, too
    PLMAP( "FillTransparenceGradientName",  XML_NAMESPACE_DRAW,     XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FILLTRANSNAME ),
    PLMAP( "FillBitmapSizeX",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     0 ),
    PLMAP( "FillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       0 ),
    PLMAP( "FillBitmapSizeY",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     0 ),
    PLMAP( "FillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       0 ),
    PLMAP( "FillBitmapMode",                XML_NAMESPACE_STYLE,    XML_REPEAT,                 XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY,        0 ),
    PLMAP( "FillBitmapPositionOffsetX",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT,                                       0 ),
    PLMAP( "FillBitmapPositionOffsetY",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT,                                       0 ),
    PLMAP( "FillBitmapRectanglePoint",      XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT,   XML_SW_TYPE_BITMAP_REFPOINT,                            0 ),
    PLMAP( "FillBitmapOffsetX",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY,   CTF_PM_REPEAT_OFFSET_X ),
    PLMAP( "FillBitmapOffsetY",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY,   CTF_PM_REPEAT_OFFSET_Y ),

    // Index 85: footnote
    PLMAP( "FootnoteHeight",            XML_NAMESPACE_STYLE,    XML_FOOTNOTE_MAX_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FTN_HEIGTH ),
    PLMAP( "FootnoteLineAdjust",        XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_TEXT_HORIZONTAL_ADJUST|MID_FLAG_SPECIAL_ITEM,  CTF_PM_FTN_LINE_ADJUST ),
    PLMAP( "FootnoteLineColor",     XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM,       CTF_PM_FTN_LINE_COLOR ),
    PLMAP( "FootnoteLineDistance",  XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,CTF_PM_FTN_DISTANCE ),
    PLMAP( "FootnoteLineAdjust",        XML_NAMESPACE_STYLE,    XML__EMPTY,        XML_TYPE_TEXT_HORIZONTAL_ADJUST|MID_FLAG_SPECIAL_ITEM,    CTF_PM_FTN_LINE_ADJUST ),
    PLMAP( "FootnoteLineColor",        XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM,        CTF_PM_FTN_LINE_COLOR ),
    PLMAP( "FootnoteLineDistance",    XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,CTF_PM_FTN_DISTANCE ),
    PLMAP( "FootnoteLineRelativeWidth", XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_PERCENT8|MID_FLAG_SPECIAL_ITEM,    CTF_PM_FTN_LINE_WIDTH ),
    PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY,     XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ),
    PLMAP( "FootnoteLineWeight",        XML_NAMESPACE_STYLE,    XML_FOOTNOTE_SEP,   XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM,   CTF_PM_FTN_LINE_WEIGTH ),
    PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE,    XML__EMPTY,     XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,    CTF_PM_FTN_LINE_DISTANCE ),
    PLMAP( "FootnoteLineWeight",        XML_NAMESPACE_STYLE,    XML_FOOTNOTE_SEP,    XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM,    CTF_PM_FTN_LINE_WEIGTH ),

// header
    HFMAP( "HeaderHeight",              XML_NAMESPACE_SVG,      XML_HEIGHT,                     XML_TYPE_MEASURE,       CTF_PM_HEADERHEIGHT ),
    HFMAP( "HeaderHeight",              XML_NAMESPACE_FO,       XML_MIN_HEIGHT,                 XML_TYPE_MEASURE,       CTF_PM_HEADERMINHEIGHT ),
    HFMAP( "HeaderIsDynamicHeight",     XML_NAMESPACE_STYLE,    XML__EMPTY,                     XML_TYPE_BOOL,          CTF_PM_HEADERDYNAMIC ),
    HFMAP( "HeaderLeftMargin",          XML_NAMESPACE_FO,       XML_MARGIN,                     XML_TYPE_MEASURE,       CTF_PM_HEADERMARGINALL ),
    HFMAP( "HeaderLeftMargin",          XML_NAMESPACE_FO,       XML_MARGIN_LEFT,                XML_TYPE_MEASURE,       CTF_PM_HEADERMARGINLEFT ),
    HFMAP( "HeaderRightMargin",         XML_NAMESPACE_FO,       XML_MARGIN_RIGHT,               XML_TYPE_MEASURE,       CTF_PM_HEADERMARGINRIGHT ),
    HFMAP( "HeaderBodyDistance",        XML_NAMESPACE_FO,       XML_MARGIN_BOTTOM,              XML_TYPE_MEASURE,       CTF_PM_HEADERMARGINBOTTOM ),
    HFMAP( "HeaderTopBorder",               XML_NAMESPACE_FO,       XML_BORDER,                     XML_TYPE_BORDER,        CTF_PM_HEADERBORDERALL ),
    HFMAP( "HeaderTopBorder",               XML_NAMESPACE_FO,       XML_BORDER_TOP,                 XML_TYPE_BORDER,        CTF_PM_HEADERBORDERTOP ),
    HFMAP( "HeaderBottomBorder",            XML_NAMESPACE_FO,       XML_BORDER_BOTTOM,              XML_TYPE_BORDER,        CTF_PM_HEADERBORDERBOTTOM ),
    HFMAP( "HeaderLeftBorder",          XML_NAMESPACE_FO,       XML_BORDER_LEFT,                XML_TYPE_BORDER,        CTF_PM_HEADERBORDERLEFT ),
    HFMAP( "HeaderRightBorder",         XML_NAMESPACE_FO,       XML_BORDER_RIGHT,               XML_TYPE_BORDER,        CTF_PM_HEADERBORDERRIGHT ),
    HFMAP( "HeaderTopBorder",               XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,          XML_TYPE_BORDER_WIDTH,  CTF_PM_HEADERBORDERWIDTHALL ),
    HFMAP( "HeaderTopBorder",               XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,      XML_TYPE_BORDER_WIDTH,  CTF_PM_HEADERBORDERWIDTHTOP ),
    HFMAP( "HeaderBottomBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,   XML_TYPE_BORDER_WIDTH,  CTF_PM_HEADERBORDERWIDTHBOTTOM ),
    HFMAP( "HeaderLeftBorder",          XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,  CTF_PM_HEADERBORDERWIDTHLEFT ),
    HFMAP( "HeaderRightBorder",         XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,  CTF_PM_HEADERBORDERWIDTHRIGHT ),
    HFMAP( "HeaderTopBorderDistance",   XML_NAMESPACE_FO,       XML_PADDING,                    XML_TYPE_MEASURE,       CTF_PM_HEADERPADDINGALL ),
    HFMAP( "HeaderTopBorderDistance",   XML_NAMESPACE_FO,       XML_PADDING_TOP,                XML_TYPE_MEASURE,       CTF_PM_HEADERPADDINGTOP ),
    HFMAP( "HeaderBottomBorderDistance",    XML_NAMESPACE_FO,       XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,       CTF_PM_HEADERPADDINGBOTTOM ),
    HFMAP( "HeaderLeftBorderDistance",  XML_NAMESPACE_FO,       XML_PADDING_LEFT,               XML_TYPE_MEASURE,       CTF_PM_HEADERPADDINGLEFT ),
    HFMAP( "HeaderRightBorderDistance", XML_NAMESPACE_FO,       XML_PADDING_RIGHT,              XML_TYPE_MEASURE,       CTF_PM_HEADERPADDINGRIGHT ),
    HFMAP( "HeaderShadowFormat",            XML_NAMESPACE_STYLE,    XML_SHADOW,                     XML_TYPE_TEXT_SHADOW,   CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackColor",               XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackTransparent",     XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,      CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackGraphicLocation", XML_NAMESPACE_STYLE,    XML_POSITION,                   XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,      CTF_PM_HEADERGRAPHICPOSITION ),
    HFMAP( "HeaderBackGraphicFilter",       XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_HEADERGRAPHICFILTER ),
    HFMAP( "HeaderBackGraphicURL",      XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,           XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_HEADERGRAPHICURL ),
    //////////////////////////////////////////////////////////////////////////
    //UUUUIndex 92: Section for 'header-style' own section, all members *have* to use CTF_PM_HEADERFLAG in the context entry (the 5th one)
    HFMAP( "HeaderHeight",                XML_NAMESPACE_SVG,        XML_HEIGHT,                     XML_TYPE_MEASURE,        CTF_PM_HEADERHEIGHT ),
    HFMAP( "HeaderHeight",                XML_NAMESPACE_FO,        XML_MIN_HEIGHT,                 XML_TYPE_MEASURE,        CTF_PM_HEADERMINHEIGHT ),
    HFMAP( "HeaderIsDynamicHeight",        XML_NAMESPACE_STYLE,    XML__EMPTY,                        XML_TYPE_BOOL,            CTF_PM_HEADERDYNAMIC ),
    HFMAP( "HeaderLeftMargin",            XML_NAMESPACE_FO,        XML_MARGIN,                        XML_TYPE_MEASURE,        CTF_PM_HEADERMARGINALL ),
    HFMAP( "HeaderLeftMargin",            XML_NAMESPACE_FO,        XML_MARGIN_LEFT,                XML_TYPE_MEASURE,        CTF_PM_HEADERMARGINLEFT ),
    HFMAP( "HeaderRightMargin",            XML_NAMESPACE_FO,        XML_MARGIN_RIGHT,                XML_TYPE_MEASURE,        CTF_PM_HEADERMARGINRIGHT ),
    HFMAP( "HeaderBodyDistance",        XML_NAMESPACE_FO,        XML_MARGIN_BOTTOM,                XML_TYPE_MEASURE,        CTF_PM_HEADERMARGINBOTTOM ),
    HFMAP( "HeaderTopBorder",                XML_NAMESPACE_FO,        XML_BORDER,                        XML_TYPE_BORDER,        CTF_PM_HEADERBORDERALL ),
    HFMAP( "HeaderTopBorder",                XML_NAMESPACE_FO,        XML_BORDER_TOP,                 XML_TYPE_BORDER,        CTF_PM_HEADERBORDERTOP ),
    HFMAP( "HeaderBottomBorder",            XML_NAMESPACE_FO,        XML_BORDER_BOTTOM,                XML_TYPE_BORDER,        CTF_PM_HEADERBORDERBOTTOM ),
    HFMAP( "HeaderLeftBorder",            XML_NAMESPACE_FO,        XML_BORDER_LEFT,                XML_TYPE_BORDER,        CTF_PM_HEADERBORDERLEFT ),
    HFMAP( "HeaderRightBorder",            XML_NAMESPACE_FO,        XML_BORDER_RIGHT,                XML_TYPE_BORDER,        CTF_PM_HEADERBORDERRIGHT ),
    HFMAP( "HeaderTopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,            XML_TYPE_BORDER_WIDTH,    CTF_PM_HEADERBORDERWIDTHALL ),
    HFMAP( "HeaderTopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,        XML_TYPE_BORDER_WIDTH,    CTF_PM_HEADERBORDERWIDTHTOP ),
    HFMAP( "HeaderBottomBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,    XML_TYPE_BORDER_WIDTH,    CTF_PM_HEADERBORDERWIDTHBOTTOM ),
    HFMAP( "HeaderLeftBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,    CTF_PM_HEADERBORDERWIDTHLEFT ),
    HFMAP( "HeaderRightBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,    CTF_PM_HEADERBORDERWIDTHRIGHT ),
    HFMAP( "HeaderTopBorderDistance",     XML_NAMESPACE_FO,        XML_PADDING,                    XML_TYPE_MEASURE,        CTF_PM_HEADERPADDINGALL ),
    HFMAP( "HeaderTopBorderDistance",     XML_NAMESPACE_FO,        XML_PADDING_TOP,                XML_TYPE_MEASURE,        CTF_PM_HEADERPADDINGTOP ),
    HFMAP( "HeaderBottomBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,        CTF_PM_HEADERPADDINGBOTTOM ),
    HFMAP( "HeaderLeftBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_LEFT,                XML_TYPE_MEASURE,        CTF_PM_HEADERPADDINGLEFT ),
    HFMAP( "HeaderRightBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_RIGHT,                XML_TYPE_MEASURE,        CTF_PM_HEADERPADDINGRIGHT ),
    HFMAP( "HeaderShadowFormat",            XML_NAMESPACE_STYLE,    XML_SHADOW,                     XML_TYPE_TEXT_SHADOW,    CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackColor",                XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackTransparent",        XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,        CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderBackGraphicLocation",    XML_NAMESPACE_STYLE,    XML_POSITION,                    XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,        CTF_PM_HEADERGRAPHICPOSITION ),
    HFMAP( "HeaderBackGraphicFilter",        XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_HEADERGRAPHICFILTER ),
    HFMAP( "HeaderBackGraphicURL",        XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,            XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_HEADERGRAPHICURL ),
    HFMAP( "HeaderDynamicSpacing",        XML_NAMESPACE_STYLE,    XML_DYNAMIC_SPACING,            XML_TYPE_BOOL,          CTF_PM_HEADERFLAG ),

// footer
    HFMAP( "FooterHeight",              XML_NAMESPACE_SVG,      XML_HEIGHT,                     XML_TYPE_MEASURE,       CTF_PM_FOOTERHEIGHT ),
    HFMAP( "FooterHeight",              XML_NAMESPACE_FO,       XML_MIN_HEIGHT,                 XML_TYPE_MEASURE,       CTF_PM_FOOTERMINHEIGHT ),
    HFMAP( "FooterIsDynamicHeight",     XML_NAMESPACE_STYLE,    XML__EMPTY,                     XML_TYPE_BOOL,          CTF_PM_FOOTERDYNAMIC ),
    HFMAP( "FooterLeftMargin",          XML_NAMESPACE_FO,       XML_MARGIN,                     XML_TYPE_MEASURE,       CTF_PM_FOOTERMARGINALL ),
    HFMAP( "FooterLeftMargin",          XML_NAMESPACE_FO,       XML_MARGIN_LEFT,                XML_TYPE_MEASURE,       CTF_PM_FOOTERMARGINLEFT ),
    HFMAP( "FooterRightMargin",         XML_NAMESPACE_FO,       XML_MARGIN_RIGHT,               XML_TYPE_MEASURE,       CTF_PM_FOOTERMARGINRIGHT ),
    HFMAP( "FooterBodyDistance",        XML_NAMESPACE_FO,       XML_MARGIN_TOP,                 XML_TYPE_MEASURE,       CTF_PM_FOOTERMARGINTOP ),
    HFMAP( "FooterTopBorder",               XML_NAMESPACE_FO,       XML_BORDER,                     XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERALL ),
    HFMAP( "FooterTopBorder",               XML_NAMESPACE_FO,       XML_BORDER_TOP,                 XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERTOP ),
    HFMAP( "FooterBottomBorder",            XML_NAMESPACE_FO,       XML_BORDER_BOTTOM,              XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERBOTTOM ),
    HFMAP( "FooterLeftBorder",          XML_NAMESPACE_FO,       XML_BORDER_LEFT,                XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERLEFT ),
    HFMAP( "FooterRightBorder",         XML_NAMESPACE_FO,       XML_BORDER_RIGHT,               XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERRIGHT ),
    HFMAP( "FooterTopBorder",               XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,          XML_TYPE_BORDER_WIDTH,  CTF_PM_FOOTERBORDERWIDTHALL ),
    HFMAP( "FooterTopBorder",               XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,      XML_TYPE_BORDER_WIDTH,  CTF_PM_FOOTERBORDERWIDTHTOP ),
    HFMAP( "FooterBottomBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,   XML_TYPE_BORDER_WIDTH,  CTF_PM_FOOTERBORDERWIDTHBOTTOM ),
    HFMAP( "FooterLeftBorder",          XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,  CTF_PM_FOOTERBORDERWIDTHLEFT ),
    HFMAP( "FooterRightBorder",         XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,  CTF_PM_FOOTERBORDERWIDTHRIGHT ),
    HFMAP( "FooterTopBorderDistance",   XML_NAMESPACE_FO,       XML_PADDING,                    XML_TYPE_MEASURE,       CTF_PM_FOOTERPADDINGALL ),
    HFMAP( "FooterTopBorderDistance",   XML_NAMESPACE_FO,       XML_PADDING_TOP,                XML_TYPE_MEASURE,       CTF_PM_FOOTERPADDINGTOP ),
    HFMAP( "FooterBottomBorderDistance",    XML_NAMESPACE_FO,       XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,       CTF_PM_FOOTERPADDINGBOTTOM ),
    HFMAP( "FooterLeftBorderDistance",  XML_NAMESPACE_FO,       XML_PADDING_LEFT,               XML_TYPE_MEASURE,       CTF_PM_FOOTERPADDINGLEFT ),
    HFMAP( "FooterRightBorderDistance", XML_NAMESPACE_FO,       XML_PADDING_RIGHT,              XML_TYPE_MEASURE,       CTF_PM_FOOTERPADDINGRIGHT ),
    HFMAP( "FooterShadowFormat",            XML_NAMESPACE_STYLE,    XML_SHADOW,                     XML_TYPE_TEXT_SHADOW,   CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackColor",               XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackTransparent",     XML_NAMESPACE_FO,       XML_BACKGROUND_COLOR,           XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,      CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackGraphicLocation", XML_NAMESPACE_STYLE,    XML_POSITION,                   XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,      CTF_PM_FOOTERGRAPHICPOSITION ),
    HFMAP( "FooterBackGraphicFilter",   XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_FOOTERGRAPHICFILTER ),
    HFMAP( "FooterBackGraphicURL",      XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,           XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_FOOTERGRAPHICURL ),
    //UUUUIndex 121: Header DrawingLayer FillAttributes
    // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
    // Names have to begin with 'Header', all 5th entries need to be ORed with the CTF_PM_HEADERFLAG
    HFMAP( "HeaderFillStyle",                     XML_NAMESPACE_DRAW,     XML_FILL,                   XML_SW_TYPE_FILLSTYLE,                                  CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillColor",                     XML_NAMESPACE_DRAW,     XML_FILL_COLOR,             XML_TYPE_COLOR,                                         CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillColor2",                    XML_NAMESPACE_DRAW,     XML_SECONDARY_FILL_COLOR,   XML_TYPE_COLOR,                                         CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillGradientName",              XML_NAMESPACE_DRAW,     XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_HEADERFILLGRADIENTNAME ),
    HFMAP( "HeaderFillGradientStepCount",         XML_NAMESPACE_DRAW,     XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16,                                      CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillHatchName",                 XML_NAMESPACE_DRAW,     XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_HEADERFILLHATCHNAME ),
    HFMAP( "HeaderFillBackground",                XML_NAMESPACE_DRAW,     XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL,                                          CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapName",                XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_HEADERFILLBITMAPNAME ),
    HFMAP( "HeaderFillTransparence",              XML_NAMESPACE_DRAW,     XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY,         CTF_PM_HEADERFLAG ),    // exists in SW, too
    HFMAP( "HeaderFillTransparenceGradientName",  XML_NAMESPACE_DRAW,     XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_HEADERFILLTRANSNAME ),
    HFMAP( "HeaderFillBitmapSizeX",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapSizeY",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapMode",                XML_NAMESPACE_STYLE,    XML_REPEAT,                 XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY,        CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapPositionOffsetX",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT,                                       CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapPositionOffsetY",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT,                                       CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapRectanglePoint",      XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT,   XML_SW_TYPE_BITMAP_REFPOINT,                            CTF_PM_HEADERFLAG ),
    HFMAP( "HeaderFillBitmapOffsetX",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY,   CTF_PM_HEADERREPEAT_OFFSET_X ),
    HFMAP( "HeaderFillBitmapOffsetY",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY,   CTF_PM_HEADERREPEAT_OFFSET_Y ),

    //////////////////////////////////////////////////////////////////////////
    //UUUUIndex 141: Section for 'footer-style' own section, all members *have* to use CTF_PM_FOOTERFLAG in the context entry (the 5th one)
    HFMAP( "FooterHeight",                XML_NAMESPACE_SVG,        XML_HEIGHT,                     XML_TYPE_MEASURE,        CTF_PM_FOOTERHEIGHT ),
    HFMAP( "FooterHeight",                XML_NAMESPACE_FO,        XML_MIN_HEIGHT,                 XML_TYPE_MEASURE,        CTF_PM_FOOTERMINHEIGHT ),
    HFMAP( "FooterIsDynamicHeight",        XML_NAMESPACE_STYLE,    XML__EMPTY,                     XML_TYPE_BOOL,            CTF_PM_FOOTERDYNAMIC ),
    HFMAP( "FooterLeftMargin",            XML_NAMESPACE_FO,        XML_MARGIN,                        XML_TYPE_MEASURE,        CTF_PM_FOOTERMARGINALL ),
    HFMAP( "FooterLeftMargin",            XML_NAMESPACE_FO,        XML_MARGIN_LEFT,                XML_TYPE_MEASURE,        CTF_PM_FOOTERMARGINLEFT ),
    HFMAP( "FooterRightMargin",            XML_NAMESPACE_FO,        XML_MARGIN_RIGHT,                XML_TYPE_MEASURE,        CTF_PM_FOOTERMARGINRIGHT ),
    HFMAP( "FooterBodyDistance",        XML_NAMESPACE_FO,        XML_MARGIN_TOP,                 XML_TYPE_MEASURE,        CTF_PM_FOOTERMARGINTOP ),
    HFMAP( "FooterTopBorder",                XML_NAMESPACE_FO,        XML_BORDER,                     XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERALL ),
    HFMAP( "FooterTopBorder",                XML_NAMESPACE_FO,        XML_BORDER_TOP,                 XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERTOP ),
    HFMAP( "FooterBottomBorder",            XML_NAMESPACE_FO,        XML_BORDER_BOTTOM,                XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERBOTTOM ),
    HFMAP( "FooterLeftBorder",            XML_NAMESPACE_FO,        XML_BORDER_LEFT,                XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERLEFT ),
    HFMAP( "FooterRightBorder",            XML_NAMESPACE_FO,        XML_BORDER_RIGHT,                XML_TYPE_BORDER,        CTF_PM_FOOTERBORDERRIGHT ),
    HFMAP( "FooterTopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH,            XML_TYPE_BORDER_WIDTH,    CTF_PM_FOOTERBORDERWIDTHALL ),
    HFMAP( "FooterTopBorder",                XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_TOP,        XML_TYPE_BORDER_WIDTH,    CTF_PM_FOOTERBORDERWIDTHTOP ),
    HFMAP( "FooterBottomBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_BOTTOM,    XML_TYPE_BORDER_WIDTH,    CTF_PM_FOOTERBORDERWIDTHBOTTOM ),
    HFMAP( "FooterLeftBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_LEFT,     XML_TYPE_BORDER_WIDTH,    CTF_PM_FOOTERBORDERWIDTHLEFT ),
    HFMAP( "FooterRightBorder",            XML_NAMESPACE_STYLE,    XML_BORDER_LINE_WIDTH_RIGHT,    XML_TYPE_BORDER_WIDTH,    CTF_PM_FOOTERBORDERWIDTHRIGHT ),
    HFMAP( "FooterTopBorderDistance",     XML_NAMESPACE_FO,        XML_PADDING,                    XML_TYPE_MEASURE,        CTF_PM_FOOTERPADDINGALL ),
    HFMAP( "FooterTopBorderDistance",     XML_NAMESPACE_FO,        XML_PADDING_TOP,                XML_TYPE_MEASURE,        CTF_PM_FOOTERPADDINGTOP ),
    HFMAP( "FooterBottomBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_BOTTOM,             XML_TYPE_MEASURE,        CTF_PM_FOOTERPADDINGBOTTOM ),
    HFMAP( "FooterLeftBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_LEFT,                XML_TYPE_MEASURE,        CTF_PM_FOOTERPADDINGLEFT ),
    HFMAP( "FooterRightBorderDistance",    XML_NAMESPACE_FO,        XML_PADDING_RIGHT,                XML_TYPE_MEASURE,        CTF_PM_FOOTERPADDINGRIGHT ),
    HFMAP( "FooterShadowFormat",            XML_NAMESPACE_STYLE,    XML_SHADOW,                     XML_TYPE_TEXT_SHADOW,    CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackColor",                XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY,    CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackTransparent",        XML_NAMESPACE_FO,        XML_BACKGROUND_COLOR,            XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE,        CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterBackGraphicLocation",    XML_NAMESPACE_STYLE,    XML_POSITION,                    XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM,        CTF_PM_FOOTERGRAPHICPOSITION ),
    HFMAP( "FooterBackGraphicFilter",     XML_NAMESPACE_STYLE,    XML_FILTER_NAME,                XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM,                CTF_PM_FOOTERGRAPHICFILTER ),
    HFMAP( "FooterBackGraphicURL",        XML_NAMESPACE_STYLE,    XML_BACKGROUND_IMAGE,            XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM,                CTF_PM_FOOTERGRAPHICURL ),
    HFMAP( "FooterDynamicSpacing",        XML_NAMESPACE_STYLE,    XML_DYNAMIC_SPACING,           XML_TYPE_BOOL,          CTF_PM_FOOTERFLAG ),

    { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 }
    //UUUUIndex 170: Footer DrawingLayer FillAttributes
    // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
    // Names have to begin with 'Footer', all 5th entries need to be ORed with the CTF_PM_FOOTERFLAG
    HFMAP( "FooterFillStyle",                     XML_NAMESPACE_DRAW,     XML_FILL,                   XML_SW_TYPE_FILLSTYLE,                                  CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillColor",                     XML_NAMESPACE_DRAW,     XML_FILL_COLOR,             XML_TYPE_COLOR,                                         CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillColor2",                    XML_NAMESPACE_DRAW,     XML_SECONDARY_FILL_COLOR,   XML_TYPE_COLOR,                                         CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillGradientName",              XML_NAMESPACE_DRAW,     XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FOOTERFILLGRADIENTNAME ),
    HFMAP( "FooterFillGradientStepCount",         XML_NAMESPACE_DRAW,     XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16,                                      CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillHatchName",                 XML_NAMESPACE_DRAW,     XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FOOTERFILLHATCHNAME ),
    HFMAP( "FooterFillBackground",                XML_NAMESPACE_DRAW,     XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL,                                          CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapName",                XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FOOTERFILLBITMAPNAME ),
    HFMAP( "FooterFillTransparence",              XML_NAMESPACE_DRAW,     XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY,         CTF_PM_FOOTERFLAG ),    // exists in SW, too
    HFMAP( "FooterFillTransparenceGradientName",  XML_NAMESPACE_DRAW,     XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT,         CTF_PM_FOOTERFILLTRANSNAME ),
    HFMAP( "FooterFillBitmapSizeX",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapSizeY",               XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY,     CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapLogicalSize",         XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY,       CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapMode",                XML_NAMESPACE_STYLE,    XML_REPEAT,                 XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY,        CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapPositionOffsetX",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT,                                       CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapPositionOffsetY",     XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT,                                       CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapRectanglePoint",      XML_NAMESPACE_DRAW,     XML_FILL_IMAGE_REF_POINT,   XML_SW_TYPE_BITMAP_REFPOINT,                            CTF_PM_FOOTERFLAG ),
    HFMAP( "FooterFillBitmapOffsetX",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY,   CTF_PM_FOOTERREPEAT_OFFSET_X ),
    HFMAP( "FooterFillBitmapOffsetY",             XML_NAMESPACE_DRAW,     XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY,   CTF_PM_FOOTERREPEAT_OFFSET_Y ),

    { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 } // index 190
};

//eof
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index c8a0dff..b185d56 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -19,12 +19,9 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"


#include <tools/debug.hxx>
#ifndef __SGI_STL_SET
#include <set>
@@ -40,13 +37,13 @@
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <xmloff/xmlimp.hxx>

#ifndef _XMLOFF_PRSTYLEI_HXX
#include <xmloff/prstylei.hxx>
#endif
#include <xmloff/attrlist.hxx>
#include "xmloff/xmlerror.hxx"

//UUUU
#include <com/sun/star/drawing/FillStyle.hpp>

using ::rtl::OUString;
using ::rtl::OUStringBuffer;

@@ -59,6 +56,8 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::xmloff::token;

//UUUU
using namespace com::sun::star::drawing;

void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
                                        const OUString& rLocalName,
@@ -76,15 +75,25 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,

TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext );

XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
        sal_uInt16 nPrfx, const OUString& rLName,
        const Reference< XAttributeList > & xAttrList,
        SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
        sal_Bool bDefault )
:   SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, nFamily, bDefault )
,   msIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) )
,   msFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) )
,   mxStyles( &rStyles )

//UUUU
OldFillStyleDefinitionSet XMLPropStyleContext::maStandardSet;
OldFillStyleDefinitionSet XMLPropStyleContext::maHeaderSet;
OldFillStyleDefinitionSet XMLPropStyleContext::maFooterSet;
OldFillStyleDefinitionSet XMLPropStyleContext::maParaSet;

XMLPropStyleContext::XMLPropStyleContext(
    SvXMLImport& rImport,
    sal_uInt16 nPrfx,
    const OUString& rLName,
    const Reference< XAttributeList > & xAttrList,
    SvXMLStylesContext& rStyles,
    sal_uInt16 nFamily,
    sal_Bool bDefault)
:   SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, nFamily, bDefault),
    msIsPhysical(RTL_CONSTASCII_USTRINGPARAM("IsPhysical")),
    msFollowStyle(RTL_CONSTASCII_USTRINGPARAM("FollowStyle")),
    mxStyles(&rStyles)
{
}

@@ -92,6 +101,74 @@ XMLPropStyleContext::~XMLPropStyleContext()
{
}

const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet()
{
    if(maStandardSet.empty())
    {
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackTransparent")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation")));
        maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency")));
    }

    return maStandardSet;
}

const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet()
{
    if(maHeaderSet.empty())
    {
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorRGB")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackTransparent")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorTransparency")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicURL")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicFilter")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicLocation")));
        maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicTransparency")));
    }

    return maHeaderSet;
}

const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet()
{
    if(maFooterSet.empty())
    {
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorRGB")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackTransparent")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorTransparency")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicURL")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicFilter")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicLocation")));
        maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicTransparency")));
    }

    return maFooterSet;
}

const OldFillStyleDefinitionSet& XMLPropStyleContext::getParaSet()
{
    if(maParaSet.empty())
    {
        // Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
        // 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
        maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor")));
        maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackTransparent")));
        maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicLocation")));
        maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicFilter")));
        maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicURL")));

        // These are not used in aXMLParaPropMap definition, thus not needed here
        // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColorTransparency")));
        // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicTransparency")));
    }

    return maParaSet;
}

SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
        sal_uInt16 nPrefix,
        const OUString& rLocalName,
@@ -186,16 +263,45 @@ typedef ::std::set < OUString, ::comphelper::UStringLess > PropertyNameSet;

void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
{
    if( ((SvXMLStylesContext *)&mxStyles)->IsAutomaticStyle()
    SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(&mxStyles);
    UniReference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
    OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper");

    //UUUU need to filter out old fill definitions when the new ones are used. The new
    // ones are used when a FillStyle is defined
    const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH);
    bool bDrawingLayerFillStylesUsed(false);

    if(bTakeCareOfDrawingLayerFillStyle)
    {
        // check if new FillStyles are used and if so mark old ones with -1
        static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));

        if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
        {
            deactivateOldFillStyleDefinitions(getParaSet());
            bDrawingLayerFillStylesUsed = true;
        }
    }

    if( pSvXMLStylesContext->IsAutomaticStyle()
        && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )
    {
        Reference < XAutoStyleFamily > xAutoFamily =
                ((SvXMLStylesContext *)&mxStyles)->GetAutoStyles( GetFamily() );
        //UUUU Need to translate StyleName from temp MapNames to names
        // used in already imported items (already exist in the pool). This
        // is required for AutomaticStyles since these do *not* use FillPropertySet
        // and thus just trigger CheckSpecialContext in XMLTextStyleContext::FillPropertySet
        // (which may be double action anyways). The mechanism there to use _ContextID_Index_Pair
        // is not working for AutomaticStyles and is already too late, too (this
        // method is already called before XMLTextStyleContext::FillPropertySet gets called)
        if(bDrawingLayerFillStylesUsed)
        {
            translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
        }

        Reference < XAutoStyleFamily > xAutoFamily = pSvXMLStylesContext->GetAutoStyles( GetFamily() );
        if( !xAutoFamily.is() )
            return;
        UniReference < SvXMLImportPropertyMapper > xImpPrMap =
            ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper( GetFamily() );
        DBG_ASSERT( xImpPrMap.is(), "There is no import prop mapper" );
        if( xImpPrMap.is() )
        {
            Sequence< PropertyValue > aValues;
@@ -244,8 +350,7 @@ void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
        if( 0 == rName.getLength() || IsDefaultStyle() )
            return;

        Reference < XNameContainer > xFamilies =
                ((SvXMLStylesContext *)&mxStyles)->GetStylesContainer( GetFamily() );
        Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() );
        if( !xFamilies.is() )
            return;

@@ -284,10 +389,6 @@ void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
            Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );

            UniReference < XMLPropertySetMapper > xPrMap;
            UniReference < SvXMLImportPropertyMapper > xImpPrMap =
                ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper(
                                                                    GetFamily() );
            DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
            if( xImpPrMap.is() )
                xPrMap = xImpPrMap->getPropertySetMapper();
            if( xPrMap.is() )
@@ -416,3 +517,135 @@ void XMLPropStyleContext::Finish( sal_Bool bOverwrite )
}


//UUUU
bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
    const OUString& rFillStyleTag) const
{
    if(maProperties.size() && rFillStyleTag.getLength())
    {
        const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();

        if(rMapper.is())
        {
            for(::std::vector< XMLPropertyState >::const_iterator a = maProperties.begin(); a != maProperties.end(); a++)
            {
                if(a->mnIndex != -1)
                {
                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);

                    if(rPropName == rFillStyleTag)
                    {
                        FillStyle eFillStyle(FillStyle_NONE);

                        if(a->maValue >>= eFillStyle)
                        {
                            // okay, type was good, FillStyle is set
                        }
                        else
                        {
                            // also try an int (see XFillStyleItem::PutValue)
                            sal_Int32 nFillStyle(0);

                            if(a->maValue >>= nFillStyle)
                            {
                                eFillStyle = static_cast< FillStyle >(nFillStyle);
                            }
                        }

                        // we found the entry, check it
                        return FillStyle_NONE != eFillStyle;
                    }
                }
            }
        }
    }

    return false;
}

//UUUU
bool XMLPropStyleContext::deactivateOldFillStyleDefinitions(
    const OldFillStyleDefinitionSet& rHashSetOfTags)
{
    bool bRetval(false);

    if(!rHashSetOfTags.empty() && maProperties.size())
    {
        const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();

        if(rMapper.is())
        {
            for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); a++)
            {
                if(a->mnIndex != -1)
                {
                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);

                    if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
                    {
                        // mark entry as inactive
                        a->mnIndex = -1;
                        bRetval = true;
                    }
                }
            }
        }
    }

    return bRetval;
}

//UUUU
bool XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames()
{
    bool bRetval(false);

    if(maProperties.size())
    {
        const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();

        if(rMapper.is())
        {
            static OUString s_FillGradientName(RTL_CONSTASCII_USTRINGPARAM("FillGradientName"));
            static OUString s_FillHatchName(RTL_CONSTASCII_USTRINGPARAM("FillHatchName"));
            static OUString s_FillBitmapName(RTL_CONSTASCII_USTRINGPARAM("FillBitmapName"));
            static OUString s_FillTransparenceGradientName(RTL_CONSTASCII_USTRINGPARAM("FillTransparenceGradientName"));

            for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); a++)
            {
                if(a->mnIndex != -1)
                {
                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
                    sal_uInt16 aStyleFamily(0);

                    if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
                    {
                        aStyleFamily = XML_STYLE_FAMILY_SD_GRADIENT_ID;
                    }
                    else if(rPropName == s_FillHatchName)
                    {
                        aStyleFamily = XML_STYLE_FAMILY_SD_HATCH_ID;
                    }
                    else if(rPropName == s_FillBitmapName)
                    {
                        aStyleFamily = XML_STYLE_FAMILY_SD_FILL_IMAGE_ID;
                    }

                    if(aStyleFamily)
                    {
                        OUString sStyleName;

                        a->maValue >>= sStyleName;
                        sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
                        a->maValue <<= sStyleName;
                        bRetval = true;
                    }
                }
            }
        }
    }

    return bRetval;
}

//eof
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index 342057c..2c31d54 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -333,7 +333,7 @@ void SvXMLImportPropertyMapper::importXML(
                }
            }
        }
        while( ( nIndex >= 0 ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) );
        while( ( nIndex >= 0 && nIndex + 1 < nEndIdx ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) );
    }

    finished( rProperties, nStartIdx, nEndIdx );
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
index 8029249..3c284f2 100644
--- a/xmloff/source/style/xmlprmap.cxx
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -172,7 +172,7 @@ sal_Int32 XMLPropertySetMapper::GetEntryIndex(
    sal_Int32 nEntries = GetEntryCount();
    sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1;

    if ( nEntries )
    if ( nEntries && nIndex < nEntries )
    {
        do
        {
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 9f59cd8..102523d 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -19,13 +19,10 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include "txtexppr.hxx"

#include <com/sun/star/table/BorderLine.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
@@ -34,13 +31,14 @@
#include <com/sun/star/awt/FontPitch.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>

#include <tools/debug.hxx>

#include <xmloff/txtprmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "XMLSectionFootnoteConfigExport.hxx"

//UUUU
#include <xmlsdtypes.hxx>

using ::rtl::OUString;
using ::rtl::OUStringBuffer;

@@ -591,20 +589,20 @@ void XMLTextExportPropertySetMapper::ContextFilter(
        case CTF_MARGINALL:             pAllMargin = propertie; break;

        //UUUU
        case CTF_SW_REPEAT_OFFSET_X:
        case CTF_REPEAT_OFFSET_X:
            pRepeatOffsetX = propertie;
            break;

        //UUUU
        case CTF_SW_REPEAT_OFFSET_Y:
        case CTF_REPEAT_OFFSET_Y:
            pRepeatOffsetY = propertie;
            break;

        //UUUU
        case CTF_SW_FILLGRADIENTNAME:
        case CTF_SW_FILLHATCHNAME:
        case CTF_SW_FILLBITMAPNAME:
        case CTF_SW_FILLTRANSNAME:
        case CTF_FILLGRADIENTNAME:
        case CTF_FILLHATCHNAME:
        case CTF_FILLBITMAPNAME:
        case CTF_FILLTRANSNAME:
            {
                OUString aStr;
                if( (propertie->maValue >>= aStr) && 0 == aStr.getLength() )
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index c5fb255..3787943 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -19,10 +19,9 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
#include <tools/fontenum.hxx>
@@ -44,30 +43,35 @@
#include "XMLAnchorTypePropHdl.hxx"
#include <xmloff/XMLConstantsPropertyHandler.hxx>
#include "XMLClipPropertyHandler.hxx"
#ifndef _XMLOFF_XMLTEXTCOLUMNSPPROPERTYHANDLER_HXX
#include "XMLTextColumnsPropertyHandler.hxx"
#endif
#include <xmloff/NamedBoolPropertyHdl.hxx>
#ifndef _XMLOFF_TXTPRHDL_HXX
#include "txtprhdl.hxx"
#endif
// OD 2004-05-05 #i28701#
#include <com/sun/star/text/WrapInfluenceOnPosition.hpp>

//UUUU
#include <xmloff/EnumPropertyHdl.hxx>
#include <com/sun/star/drawing/FillStyle.hpp>
#include "XMLFillBitmapSizePropertyHandler.hxx"
#include "XMLBitmapLogicalSizePropertyHandler.hxx"
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"

using ::rtl::OUString;
using ::rtl::OUStringBuffer;

//using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
//using namespace ::com::sun::star::container;
//using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::text;
using namespace ::xmloff::token;

//UUUU
using namespace ::com::sun::star::drawing;

//UUUU
extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];

#define CONSTASCII_USTRINGPARAM_CMP(s) s, sizeof(s)-1

@@ -1271,18 +1275,6 @@ public:
    ~XMLTextPropertyHandlerFactory_Impl();
};

//UUUU
#include <xmloff/EnumPropertyHdl.hxx>
#include <com/sun/star/drawing/FillStyle.hpp>
#include "XMLFillBitmapSizePropertyHandler.hxx"
#include "XMLBitmapLogicalSizePropertyHandler.hxx"
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];

const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
    ( sal_Int32 nType ) const
{
@@ -1456,27 +1448,33 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
        pHdl = new XMLNumber8OneBasedHdl();
        break;

    //UUUU
    case XML_SW_TYPE_FILLSTYLE:
        pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) );
        break;
    case XML_SW_TYPE_FILLBITMAPSIZE:
        pHdl = new XMLFillBitmapSizePropertyHandler();
        break;
    case XML_SW_TYPE_LOGICAL_SIZE:
        pHdl = new XMLBitmapLogicalSizePropertyHandler();
        break;
    case XML_SW_TYPE_BITMAP_REFPOINT:
        pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) );
        break;
    case XML_SW_TYPE_BITMAP_MODE:
        pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) );
        break;
    case XML_SW_TYPE_BITMAPREPOFFSETX:
    case XML_SW_TYPE_BITMAPREPOFFSETY:
        pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
        break;
        //UUUU
        case XML_SW_TYPE_FILLSTYLE:
            pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) );
            break;
        case XML_SW_TYPE_FILLBITMAPSIZE:
            pHdl = new XMLFillBitmapSizePropertyHandler();
            break;
        case XML_SW_TYPE_LOGICAL_SIZE:
            pHdl = new XMLBitmapLogicalSizePropertyHandler();
            break;
        case XML_SW_TYPE_BITMAP_REFPOINT:
            pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) );
            break;
        case XML_SW_TYPE_BITMAP_MODE:
            pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) );
            break;
        case XML_SW_TYPE_BITMAPREPOFFSETX:
        case XML_SW_TYPE_BITMAPREPOFFSETY:
            pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
            break;

        //UUUU
        default:
        {
            OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
            break;
        }
    }

    return pHdl;
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 26587c7..e1d2205 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -19,19 +19,18 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

#include <xmloff/txtprmap.hxx>

#include <tools/debug.hxx>

#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
#include "txtprhdl.hxx"

//UUUU
#include <xmlsdtypes.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::xmloff::token;
@@ -316,6 +315,29 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
    MP_E( "ParaBackGraphicLocation",    STYLE,  POSITION,   MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS  ),
    MP_E( "ParaBackGraphicFilter",STYLE,    FILTER_NAME,    MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
    MP_E( "ParaBackGraphicURL", STYLE,  BACKGROUND_IMAGE,   MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),

    //UUUU fill attributes for paragraph backgrounds
    GMAP( "FillStyle",                      XML_NAMESPACE_DRAW, XML_FILL,                   XML_SW_TYPE_FILLSTYLE, 0 ),
    GMAP( "FillColor",                      XML_NAMESPACE_DRAW, XML_FILL_COLOR,             XML_TYPE_COLOR, 0 ),
    GMAP( "FillColor2",                     XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR,   XML_TYPE_COLOR, 0 ),
    GMAP( "FillGradientName",               XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
    GMAP( "FillGradientStepCount",          XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16, 0 ),
    GMAP( "FillHatchName",                  XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
    GMAP( "FillBackground",                 XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL, 0 ),
    GMAP( "FillBitmapName",                 XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
    GMAP( "FillTransparence",               XML_NAMESPACE_DRAW, XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ),    // exists in SW, too
    GMAP( "FillTransparenceGradientName",   XML_NAMESPACE_DRAW, XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
    GMAP( "FillBitmapSizeX",                XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapLogicalSize",          XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapSizeY",                XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapLogicalSize",          XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapMode",                 XML_NAMESPACE_STYLE,XML_REPEAT,                 XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapPositionOffsetX",      XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
    GMAP( "FillBitmapPositionOffsetY",      XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
    GMAP( "FillBitmapRectanglePoint",       XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT,   XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
    GMAP( "FillBitmapOffsetX",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
    GMAP( "FillBitmapOffsetY",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),

    // RES_BOX
    MP_E( "LeftBorder",         STYLE,  BORDER_LINE_WIDTH,        XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ),
    MP_E( "LeftBorder",         STYLE,  BORDER_LINE_WIDTH_LEFT,   XML_TYPE_BORDER_WIDTH, CTF_LEFTBORDERWIDTH ),
@@ -637,13 +659,13 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
    GMAP( "FillStyle",                      XML_NAMESPACE_DRAW, XML_FILL,                   XML_SW_TYPE_FILLSTYLE, 0 ),
    GMAP( "FillColor",                      XML_NAMESPACE_DRAW, XML_FILL_COLOR,             XML_TYPE_COLOR, 0 ),
    GMAP( "FillColor2",                     XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR,   XML_TYPE_COLOR, 0 ),
    GMAP( "FillGradientName",               XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLGRADIENTNAME ),
    GMAP( "FillGradientName",               XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME,     XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ),
    GMAP( "FillGradientStepCount",          XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT,    XML_TYPE_NUMBER16, 0 ),
    GMAP( "FillHatchName",                  XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLHATCHNAME ),
    GMAP( "FillHatchName",                  XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ),
    GMAP( "FillBackground",                 XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID,       XML_TYPE_BOOL, 0 ),
    GMAP( "FillBitmapName",                 XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLBITMAPNAME ),
    GMAP( "FillBitmapName",                 XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME,        XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ),
    GMAP( "FillTransparence",               XML_NAMESPACE_DRAW, XML_OPACITY,                XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ),    // exists in SW, too
    GMAP( "FillTransparenceGradientName",   XML_NAMESPACE_DRAW, XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLTRANSNAME ),
    GMAP( "FillTransparenceGradientName",   XML_NAMESPACE_DRAW, XML_OPACITY_NAME,           XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ),
    GMAP( "FillBitmapSizeX",                XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapLogicalSize",          XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH,       XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
    GMAP( "FillBitmapSizeY",                XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT,      XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
@@ -652,8 +674,8 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
    GMAP( "FillBitmapPositionOffsetX",      XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
    GMAP( "FillBitmapPositionOffsetY",      XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
    GMAP( "FillBitmapRectanglePoint",       XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT,   XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
    GMAP( "FillBitmapOffsetX",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_SW_REPEAT_OFFSET_X ),
    GMAP( "FillBitmapOffsetY",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_SW_REPEAT_OFFSET_Y ),
    GMAP( "FillBitmapOffsetX",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
    GMAP( "FillBitmapOffsetY",              XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET,     XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),

    // RES_BOX
    MG_ED( "LeftBorder",            STYLE,  BORDER_LINE_WIDTH,        XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ),
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 787a26d..8bc1823 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -19,8 +19,6 @@
 *
 *************************************************************/



// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"

@@ -35,7 +33,6 @@
#include "xmloff/xmltkmap.hxx"
#include "xmloff/xmltoken.hxx"
#include "xmloff/xmluconv.hxx"

#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
@@ -43,7 +40,6 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/ParagraphStyleCategory.hpp>
#include <com/sun/star/style/XStyle.hpp>

#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>

@@ -53,6 +49,10 @@
#include <utility>
#include <vector>

//UUUU
#include <xmlsdtypes.hxx>
#include <xmloff/xmlerror.hxx>

using ::rtl::OUString;
using ::rtl::OUStringBuffer;

@@ -424,22 +424,19 @@ void XMLTextStyleContext::FillPropertySet(
    // catch the combined characters attribute

    // imitate XMLPropStyleContext::FillPropertySet(...)
    UniReference < SvXMLImportPropertyMapper > xImpPrMap =
        ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily());
    DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" );
    if( xImpPrMap.is() )
    SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(GetStyles());
    UniReference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
    DBG_ASSERT(xImpPrMap.is(),"Where is the import prop mapper?");

    if(xImpPrMap.is())
    {

        // imitate SvXMLImportPropertyMapper::FillPropertySet(...)

        // The reason for this is that we have no other way to
        // efficiently intercept the value of combined characters. To
        // get that value, we could iterate through the map once more,
        // but instead we chose to insert the code into this
        // iteration. I haven't been able to come up with a much more
        // intelligent solution.


        struct _ContextID_Index_Pair aContextIDs[] =
        {
            { CTF_COMBINED_CHARACTERS_FIELD, -1 },
@@ -449,28 +446,56 @@ void XMLTextStyleContext::FillPropertySet(
            { CTF_FONTFAMILYNAME, -1 },
            { CTF_FONTFAMILYNAME_CJK, -1 },
            { CTF_FONTFAMILYNAME_CTL, -1 },

            //UUU need special handling for DrawingLayer FillStyle names
            { CTF_FILLGRADIENTNAME, -1 },
            { CTF_FILLTRANSNAME, -1 },
            { CTF_FILLHATCHNAME, -1 },
            { CTF_FILLBITMAPNAME, -1 },

            { -1, -1 }
        };

        // get property set info
        Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW );
        // the style families associated with the same index modulo 4
        static sal_uInt16 aFamilies[] =
        {
            XML_STYLE_FAMILY_SD_GRADIENT_ID,
            XML_STYLE_FAMILY_SD_GRADIENT_ID,
            XML_STYLE_FAMILY_SD_HATCH_ID,
            XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
        };

        // get property set info
        Reference< XPropertySetInfo > xInfo;
        UniReference< XMLPropertySetMapper > rPropMapper;
        bool bAutomatic = false;
        if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() &&
            ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) )

        if(pSvXMLStylesContext->IsAutomaticStyle() &&
            (XML_STYLE_FAMILY_TEXT_TEXT == GetFamily() || XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily()))
        {
            bAutomatic = true;

            if( GetAutoName().getLength() )
            {
                OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ?
                    OUString( RTL_CONSTASCII_USTRINGPARAM("CharAutoStyleName") ):
                    OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAutoStyleName") );

                try
                {
                    if(!xInfo.is())
                    {
                        xInfo = rPropSet->getPropertySetInfo();
                    }

                    if ( xInfo->hasPropertyByName( sAutoProp ) )
                    {
                        rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) );
                    }
                    else
                    {
                        bAutomatic = false;
                    }
                }
                catch( const RuntimeException& ) { throw; }
                catch( const Exception& )
@@ -480,13 +505,19 @@ void XMLTextStyleContext::FillPropertySet(
                }
            }
        }

        if( bAutomatic )
        {
            xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs );
        }
        else
        {
            xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
        }

        sal_Int32 nIndex = aContextIDs[0].nIndex;

        // have we found a combined characters
        sal_Int32 nIndex = aContextIDs[0].nIndex;
        if ( nIndex != -1 )
        {
            Any& rAny = GetProperties()[nIndex].maValue;
@@ -499,77 +530,146 @@ void XMLTextStyleContext::FillPropertySet(
        // value; if we didn't find one, we'll set to false, the file
        // format default.
        // border-model: same
        if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW )
        if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_ROW == GetFamily())
        {
            OUString sIsSplitAllowed =
                OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSplitAllowed" ) );
            DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
                        "property missing?" );
            rPropSet->setPropertyValue( sIsSplitAllowed,
                (aContextIDs[1].nIndex == -1)
                ? makeAny( false )
                : GetProperties()[aContextIDs[1].nIndex].maValue );
            OUString sIsSplitAllowed = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSplitAllowed" ) );
            DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "property missing?" );
            rPropSet->setPropertyValue(
                sIsSplitAllowed,
                (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue );
        }

        if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE )
        if(XML_STYLE_FAMILY_TABLE_TABLE == IsDefaultStyle() && GetFamily())
        {
            OUString sCollapsingBorders(
                OUString( RTL_CONSTASCII_USTRINGPARAM( "CollapsingBorders" ) ) );
            DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
                        "property missing?" );
            rPropSet->setPropertyValue( sCollapsingBorders,
            OUString sCollapsingBorders(OUString( RTL_CONSTASCII_USTRINGPARAM( "CollapsingBorders" ) ) );
            DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "property missing?" );
            rPropSet->setPropertyValue(
                sCollapsingBorders,
                (aContextIDs[2].nIndex == -1)
                ? makeAny( false )
                : GetProperties()[aContextIDs[2].nIndex].maValue );
        }


        // check for StarBats and StarMath fonts

        // iterate over aContextIDs entries 3..6
        for ( sal_Int32 i = 3; i < 7; i++ )
        // iterate over aContextIDs entries, start with 3, prev ones are already used above
        for(sal_uInt16 i(3); aContextIDs[i].nContextID != -1; i++)
        {
            nIndex = aContextIDs[i].nIndex;

            if ( nIndex != -1 )
            {
                // Found!
                struct XMLPropertyState& rState = GetProperties()[nIndex];
                Any rAny = rState.maValue;
                sal_Int32 nMapperIndex = rState.mnIndex;

                // Now check for font name in rState and set corrected value,
                // if necessary.
                OUString sFontName;
                rAny >>= sFontName;
                if ( sFontName.getLength() > 0 )
                switch(aContextIDs[i].nContextID)
                {
                    OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM("StarBats" ) );
                    OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM("StarMath" ) );
                    if ( sFontName.equalsIgnoreAsciiCase( sStarBats ) ||
                         sFontName.equalsIgnoreAsciiCase( sStarMath ) )
                    case CTF_FILLGRADIENTNAME:
                    case CTF_FILLTRANSNAME:
                    case CTF_FILLHATCHNAME:
                    case CTF_FILLBITMAPNAME:
                    {
                        // construct new value
                        sFontName = OUString(
                            RTL_CONSTASCII_USTRINGPARAM("StarSymbol") );
                        Any aAny( rAny );
                        aAny <<= sFontName;
                        // DrawingLayer FillStyle name´needs to be mapped to DisplayName
                        rtl::OUString sStyleName;
                        rState.maValue >>= sStyleName;

                        // get property set mapper
                        UniReference<XMLPropertySetMapper> rPropMapper =
                            xImpPrMap->getPropertySetMapper();
                        //UUUU translate the used name from ODF intern to the name used in the Model
                        sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName);

                        // set property
                        OUString rPropertyName(
                            rPropMapper->GetEntryAPIName(nMapperIndex) );
                        if ( xInfo->hasPropertyByName( rPropertyName ) )
                        if(bAutomatic)
                        {
                            rPropSet->setPropertyValue( rPropertyName, aAny );
                            // in this case the rPropSet got not really filled since above the call to
                            // CheckSpecialContext was used and not FillPropertySet, thus the below call to
                            // setPropertyValue can fail/will not be useful (e.g. when the rPropSet
                            // is a SwXTextCursor).
                            // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert,
                            // thus the whole mechanism based on _ContextID_Index_Pair will not work
                            // in that case. Thus the slots which need to be converted already get
                            // converted there (its called first) and not here (see
                            // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames)
                            // For convenience, still Write back the corrected value to the XMLPropertyState entry
                            rState.maValue <<= sStyleName;
                            break;
                        }

                        // Still needed if it's not an AutomaticStyle (!)
                        try
                        {
                            if(!rPropMapper.is())
                            {
                                rPropMapper = xImpPrMap->getPropertySetMapper();
                            }

                            // set property
                            const rtl::OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex);

                            if(!xInfo.is())
                            {
                                xInfo = rPropSet->getPropertySetInfo();
                            }

                            if(xInfo->hasPropertyByName(rPropertyName))
                            {
                                rPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
                            }
                        }
                        catch(::com::sun::star::lang::IllegalArgumentException& e)
                        {
                            Sequence< rtl::OUString > aSeq(1);
                            aSeq[0] = sStyleName;
                            GetImport().SetError(XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, aSeq, e.Message, NULL);
                        }
                        break;
                    }
                    // else: "normal" style name -> no correction is necessary
                    default:
                    {
                        // check for StarBats and StarMath fonts
                        Any rAny = rState.maValue;
                        sal_Int32 nMapperIndex = rState.mnIndex;

                        // Now check for font name in rState and set corrected value,
                        // if necessary.
                        OUString sFontName;
                        rAny >>= sFontName;

                        if(sFontName.getLength() > 0)
                        {
                            OUString sStarBats(RTL_CONSTASCII_USTRINGPARAM("StarBats"));
                            OUString sStarMath(RTL_CONSTASCII_USTRINGPARAM("StarMath"));
                            if(sFontName.equalsIgnoreAsciiCase(sStarBats) ||
                                sFontName.equalsIgnoreAsciiCase(sStarMath))
                            {
                                // construct new value
                                sFontName = OUString(
                                    RTL_CONSTASCII_USTRINGPARAM("StarSymbol"));
                                Any aAny(rAny);
                                aAny <<= sFontName;

                                if(!rPropMapper.is())
                                {
                                    rPropMapper = xImpPrMap->getPropertySetMapper();
                                }

                                // set property
                                OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex));

                                if(!xInfo.is())
                                {
                                    xInfo = rPropSet->getPropertySetInfo();
                                }

                                if(xInfo->hasPropertyByName(rPropertyName))
                                {
                                    rPropSet->setPropertyValue(rPropertyName,aAny);
                                }
                            }
                            // else: "normal" style name -> no correction is necessary
                        }
                        // else: no style name found -> illegal value -> ignore
                    }
                }
                // else: no style name found -> illegal value -> ignore
            }
        }
    }
}

//eof