provide two LegendPositionResources for the interim

LegendPositionResources for .ui based stuff and a legacy
oldLegendPositionResources which can be phased out when
the last .res based user is gone

Change-Id: I02478882e0cb54ee0fe5c2c5d15382f94758a3d2
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
index e291771..c8513d2 100644
--- a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
@@ -30,7 +30,7 @@ using namespace ::com::sun::star;

SchLegendDlg::SchLegendDlg(Window* pWindow, const uno::Reference< uno::XComponentContext>& xCC )
    : ModalDialog(pWindow, SchResId(DLG_LEGEND))
    , m_apLegendPositionResources( new LegendPositionResources(this,xCC) )
    , m_apLegendPositionResources( new oldLegendPositionResources(this,xCC) )
    , aBtnOK(this, SchResId(BTN_OK))
    , aBtnCancel(this, SchResId(BTN_CANCEL))
    , aBtnHelp(this, SchResId(BTN_HELP))
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index 3f0b459..fe7d3df 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -42,7 +42,219 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;

LegendPositionResources::LegendPositionResources( Window* pWindow )
LegendPositionResources::LegendPositionResources(VclBuilderContainer& rParent)
    : m_xCC() //unused in this scenario
    , m_pCbxShow( NULL ) //unused in this scenario, assumed to be visible
{
    rParent.get(m_pRbtLeft, "left");
    rParent.get(m_pRbtRight, "right");
    rParent.get(m_pRbtTop, "top");
    rParent.get(m_pRbtBottom, "bottom");
    impl_setRadioButtonToggleHdl();
}

LegendPositionResources::LegendPositionResources(VclBuilderContainer& rParent,
    const uno::Reference< uno::XComponentContext >& xCC)
    : m_xCC(xCC)
{
    rParent.get(m_pCbxShow, "show");
    rParent.get(m_pRbtLeft, "left");
    rParent.get(m_pRbtRight, "right");
    rParent.get(m_pRbtTop, "top");
    rParent.get(m_pRbtBottom, "bottom");

    m_pCbxShow->SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) );
    impl_setRadioButtonToggleHdl();
}

void LegendPositionResources::impl_setRadioButtonToggleHdl()
{
    m_pRbtLeft->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_pRbtTop->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_pRbtRight->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_pRbtBottom->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
}

LegendPositionResources::~LegendPositionResources()
{
}

void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
{
    try
    {
        uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartModel );
        uno::Reference< beans::XPropertySet > xProp( xDiagram->getLegend(), uno::UNO_QUERY );
        if( xProp.is() )
        {
            //show
            sal_Bool bShowLegend = sal_False;
            xProp->getPropertyValue( "Show" ) >>= bShowLegend;
            if (m_pCbxShow)
                m_pCbxShow->Check( bShowLegend );
            PositionEnableHdl(0);

            //position
            chart2::LegendPosition ePos;
            xProp->getPropertyValue( "AnchorPosition" )  >>= ePos;
            switch( ePos )
            {
                case chart2::LegendPosition_LINE_START:
                    m_pRbtLeft->Check();
                    break;
                case chart2::LegendPosition_LINE_END:
                    m_pRbtRight->Check();
                    break;
                case chart2::LegendPosition_PAGE_START:
                    m_pRbtTop->Check();
                    break;
                case chart2::LegendPosition_PAGE_END:
                    m_pRbtBottom->Check();
                    break;

                case chart2::LegendPosition_CUSTOM:
                default:
                    m_pRbtRight->Check();
                    break;
            }
        }
    }
    catch( const uno::Exception & ex )
    {
        ASSERT_EXCEPTION( ex );
    }
}

void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Reference< frame::XModel >& xChartModel ) const
{
    try
    {
        sal_Bool bShowLegend = m_pCbxShow ? m_pCbxShow->IsChecked() : false;
        ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
        uno::Reference< beans::XPropertySet > xProp( LegendHelper::getLegend( *pModel,m_xCC,bShowLegend ), uno::UNO_QUERY );
        if( xProp.is() )
        {
            //show
            xProp->setPropertyValue( "Show" , uno::makeAny( bShowLegend ));

            //position
            chart2::LegendPosition eNewPos;
            ::com::sun::star::chart::ChartLegendExpansion eExp = ::com::sun::star::chart::ChartLegendExpansion_HIGH;

            if( m_pRbtLeft->IsChecked() )
                eNewPos = chart2::LegendPosition_LINE_START;
            else if( m_pRbtRight->IsChecked() )
            {
                eNewPos = chart2::LegendPosition_LINE_END;
            }
            else if( m_pRbtTop->IsChecked() )
            {
                eNewPos = chart2::LegendPosition_PAGE_START;
                eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE;
            }
            else if( m_pRbtBottom->IsChecked() )
            {
                eNewPos = chart2::LegendPosition_PAGE_END;
                eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE;
            }

            xProp->setPropertyValue( "AnchorPosition" , uno::makeAny( eNewPos ));
            xProp->setPropertyValue( "Expansion" , uno::makeAny( eExp ));
            xProp->setPropertyValue( "RelativePosition" , uno::Any());
        }
    }
    catch( const uno::Exception & ex )
    {
        ASSERT_EXCEPTION( ex );
    }
}

IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl)
{
    bool bEnable = m_pCbxShow ? m_pCbxShow->IsChecked() : true;

    m_pRbtLeft->Enable( bEnable );
    m_pRbtTop->Enable( bEnable );
    m_pRbtRight->Enable( bEnable );
    m_pRbtBottom->Enable( bEnable );

    m_aChangeLink.Call(NULL);

    return 0;
}

void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
{
    const SfxPoolItem* pPoolItem = NULL;
    if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, sal_True, &pPoolItem ) == SFX_ITEM_SET )
    {
        sal_Int32 nLegendPosition = ((const SfxInt32Item*)pPoolItem)->GetValue();
        switch( nLegendPosition )
        {
            case chart2::LegendPosition_LINE_START:
                m_pRbtLeft->Check(sal_True);
                break;
            case chart2::LegendPosition_PAGE_START:
                m_pRbtTop->Check(sal_True);
                break;
            case chart2::LegendPosition_LINE_END:
                m_pRbtRight->Check(sal_True);
                break;
            case chart2::LegendPosition_PAGE_END:
                m_pRbtBottom->Check(sal_True);
                break;
            default:
                break;
        }
    }

    if( m_pCbxShow && rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, sal_True, &pPoolItem ) == SFX_ITEM_SET )
    {
        bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
        m_pCbxShow->Check(bShow);
    }
}

void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
{
    sal_Int32 nLegendPosition = chart2::LegendPosition_CUSTOM;
    if( m_pRbtLeft->IsChecked() )
        nLegendPosition = chart2::LegendPosition_LINE_START;
    else if( m_pRbtTop->IsChecked() )
        nLegendPosition = chart2::LegendPosition_PAGE_START;
    else if( m_pRbtRight->IsChecked() )
        nLegendPosition = chart2::LegendPosition_LINE_END;
    else if( m_pRbtBottom->IsChecked() )
        nLegendPosition = chart2::LegendPosition_PAGE_END;
    rOutAttrs.Put(SfxInt32Item(SCHATTR_LEGEND_POS, nLegendPosition ));

    rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_pCbxShow ? m_pCbxShow->IsChecked() : true) );
}

IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
{
    //for each radio click ther are coming two change events
    //first uncheck of previous button -> ignore that call
    //the second call gives the check of the new button
    if( pRadio && pRadio->IsChecked() )
        m_aChangeLink.Call(NULL);
    return 0;
}

void LegendPositionResources::SetChangeHdl( const Link& rLink )
{
    m_aChangeLink = rLink;
}

void LegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf)
{
    m_pRbtLeft->SetAccessibleRelationMemberOf(pMemberOf);
    m_pRbtRight->SetAccessibleRelationMemberOf(pMemberOf);
    m_pRbtTop->SetAccessibleRelationMemberOf(pMemberOf);
    m_pRbtBottom->SetAccessibleRelationMemberOf(pMemberOf);
}

oldLegendPositionResources::oldLegendPositionResources( Window* pWindow )
    : m_xCC() //unused in this scenario
    , m_aCbxShow( pWindow ) //unused in this scenario
    , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
@@ -54,7 +266,7 @@ LegendPositionResources::LegendPositionResources( Window* pWindow )
    impl_setRadioButtonToggleHdl();
}

LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Reference< uno::XComponentContext >& xCC )
oldLegendPositionResources::oldLegendPositionResources( Window* pWindow, const uno::Reference< uno::XComponentContext >& xCC )
    : m_xCC( xCC )
    , m_aCbxShow( pWindow, SchResId(CBX_SHOWLEGEND) )
    , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
@@ -62,7 +274,7 @@ LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Re
    , m_aRbtTop( pWindow, SchResId(RBT_TOP) )
    , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) )
{
    m_aCbxShow.SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) );
    m_aCbxShow.SetToggleHdl( LINK( this, oldLegendPositionResources, PositionEnableHdl ) );
    impl_setRadioButtonToggleHdl();
    m_aCbxShow.SetAccessibleRelationMemberOf(&m_aCbxShow);
    m_aRbtLeft.SetAccessibleRelationMemberOf(&m_aCbxShow);
@@ -71,19 +283,19 @@ LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Re
    m_aRbtBottom.SetAccessibleRelationMemberOf(&m_aCbxShow);
}

void LegendPositionResources::impl_setRadioButtonToggleHdl()
void oldLegendPositionResources::impl_setRadioButtonToggleHdl()
{
    m_aRbtLeft.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_aRbtTop.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_aRbtRight.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_aRbtBottom.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
    m_aRbtLeft.SetToggleHdl( LINK( this, oldLegendPositionResources, PositionChangeHdl ) );
    m_aRbtTop.SetToggleHdl( LINK( this, oldLegendPositionResources, PositionChangeHdl ) );
    m_aRbtRight.SetToggleHdl( LINK( this, oldLegendPositionResources, PositionChangeHdl ) );
    m_aRbtBottom.SetToggleHdl( LINK( this, oldLegendPositionResources, PositionChangeHdl ) );
}

LegendPositionResources::~LegendPositionResources()
oldLegendPositionResources::~oldLegendPositionResources()
{
}

void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
void oldLegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
{
    try
    {
@@ -128,7 +340,7 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo
    }
}

void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Reference< frame::XModel >& xChartModel ) const
void oldLegendPositionResources::writeToModel( const ::com::sun::star::uno::Reference< frame::XModel >& xChartModel ) const
{
    try
    {
@@ -172,7 +384,7 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen
    }
}

IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl)
IMPL_LINK_NOARG(oldLegendPositionResources, PositionEnableHdl)
{
    sal_Bool bEnable = m_aCbxShow.IsChecked();

@@ -186,7 +398,7 @@ IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl)
    return 0;
}

void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
void oldLegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
{
    const SfxPoolItem* pPoolItem = NULL;
    if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, sal_True, &pPoolItem ) == SFX_ITEM_SET )
@@ -218,7 +430,7 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
    }
}

void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
void oldLegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
{
    sal_Int32 nLegendPosition = chart2::LegendPosition_CUSTOM;
    if( m_aRbtLeft.IsChecked() )
@@ -234,7 +446,7 @@ void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
    rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_aCbxShow.IsChecked()) );
}

IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
IMPL_LINK( oldLegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
{
    //for each radio click ther are coming two change events
    //first uncheck of previous button -> ignore that call
@@ -244,12 +456,12 @@ IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
    return 0;
}

void LegendPositionResources::SetChangeHdl( const Link& rLink )
void oldLegendPositionResources::SetChangeHdl( const Link& rLink )
{
    m_aChangeLink = rLink;
}

void LegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf)
void oldLegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf)
{
    m_aRbtLeft.SetAccessibleRelationMemberOf(pMemberOf);
    m_aRbtRight.SetAccessibleRelationMemberOf(pMemberOf);
@@ -257,6 +469,7 @@ void LegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf)
    m_aRbtBottom.SetAccessibleRelationMemberOf(pMemberOf);
}


} //namespace chart

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.hxx b/chart2/source/controller/dialogs/res_LegendPosition.hxx
index 6d3e8d8..b28cdf9 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.hxx
@@ -19,10 +19,9 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_LEGENDPOSITION_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_LEGENDPOSITION_HXX

// header for class CheckBox
#include <vcl/builder.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
// header for class SfxItemSet
#include <svl/itemset.hxx>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -35,9 +34,9 @@ class LegendPositionResources

public:
    //constructor without Display checkbox
    LegendPositionResources( Window* pParent );
    LegendPositionResources(VclBuilderContainer& rParent);
    //constructor inclusive Display checkbox
    LegendPositionResources( Window* pParent, const ::com::sun::star::uno::Reference<
    LegendPositionResources(VclBuilderContainer& rParent, const ::com::sun::star::uno::Reference<
                       ::com::sun::star::uno::XComponentContext>& xCC );
    virtual ~LegendPositionResources();

@@ -63,6 +62,50 @@ private:
    ::com::sun::star::uno::Reference<
                       ::com::sun::star::uno::XComponentContext>    m_xCC;

    CheckBox*       m_pCbxShow;

    RadioButton*    m_pRbtLeft;
    RadioButton*    m_pRbtRight;
    RadioButton*    m_pRbtTop;
    RadioButton*    m_pRbtBottom;

    Link            m_aChangeLink;
};


class oldLegendPositionResources
{

public:
    //constructor without Display checkbox
    oldLegendPositionResources( Window* pParent );
    //constructor inclusive Display checkbox
    oldLegendPositionResources( Window* pParent, const ::com::sun::star::uno::Reference<
                       ::com::sun::star::uno::XComponentContext>& xCC );
    virtual ~oldLegendPositionResources();

    void writeToResources( const ::com::sun::star::uno::Reference<
                       ::com::sun::star::frame::XModel >& xChartModel );
    void writeToModel( const ::com::sun::star::uno::Reference<
                       ::com::sun::star::frame::XModel >& xChartModel ) const;

    void initFromItemSet( const SfxItemSet& rInAttrs );
    void writeToItemSet( SfxItemSet& rOutAttrs ) const;

    void SetChangeHdl( const Link& rLink );

    DECL_LINK( PositionEnableHdl, void* );
    DECL_LINK( PositionChangeHdl, RadioButton* );

    void SetAccessibleRelationMemberOf(Window* pMemberOf);

private:
    void impl_setRadioButtonToggleHdl();

private:
    ::com::sun::star::uno::Reference<
                       ::com::sun::star::uno::XComponentContext>    m_xCC;

    CheckBox        m_aCbxShow;

    RadioButton     m_aRbtLeft;
@@ -73,6 +116,7 @@ private:
    Link            m_aChangeLink;
};


} //namespace chart

#endif
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
index 6f30aeb..c3376b0 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -34,18 +34,11 @@ SchLegendPosTabPage::SchLegendPosTabPage(Window* pWindow, const SfxItemSet& rInA
                 ,"tp_LegendPosition"
                 ,"modules/schart/ui/tp_LegendPosition.ui"
                 , rInAttrs )
    , m_aLegendPositionResources(*this)
{
    get(m_pLbTextDirection,"LB_LEGEND_TEXTDIR");

    m_pLbTextDirection->SetDropDownLineCount(3);

    get(m_pBxPosition,"boxPOSITION");
    m_pLegendPositionResources = new LegendPositionResources(m_pBxPosition);
}

SchLegendPosTabPage::~SchLegendPosTabPage()
{
    delete m_pLegendPositionResources;
}

SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow, const SfxItemSet& rOutAttrs)
@@ -55,7 +48,7 @@ SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow, const SfxItemSet& rOutA

sal_Bool SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
    m_pLegendPositionResources->writeToItemSet(rOutAttrs);
    m_aLegendPositionResources.writeToItemSet(rOutAttrs);

    if( m_pLbTextDirection->GetSelectEntryCount() > 0 )
        rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_pLbTextDirection->GetSelectEntryValue() ) );
@@ -65,7 +58,7 @@ sal_Bool SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)

void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs)
{
    m_pLegendPositionResources->initFromItemSet(rInAttrs);
    m_aLegendPositionResources.initFromItemSet(rInAttrs);

    const SfxPoolItem* pPoolItem = 0;
    if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
index 2e2aab8..fdadbb3 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -19,30 +19,24 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_LEGENDPOSITION_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_LEGENDPOSITION_HXX

// header for SfxTabPage
#include <sfx2/tabdlg.hxx>
// header for FixedText
#include <vcl/fixed.hxx>

#include "res_LegendPosition.hxx"
#include "TextDirectionListBox.hxx"

namespace chart
{

class LegendPositionResources;
class SchLegendPosTabPage : public SfxTabPage
{
private:

//     boost::scoped_ptr< LegendPositionResources >   m_apLegendPositionResources;
    LegendPositionResources* m_pLegendPositionResources;
    VclBox*                  m_pBxPosition;

    LegendPositionResources  m_aLegendPositionResources;
    TextDirectionListBox*    m_pLbTextDirection;

public:
    SchLegendPosTabPage(Window* pParent, const SfxItemSet& rInAttrs);
    virtual ~SchLegendPosTabPage();

    static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
    virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index 966bc02..727ab0e 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -42,7 +42,7 @@ TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
        , m_aFT_TitleDescription( this, SchResId( FT_TITLEDESCRIPTION ) )
        , m_aFL_Vertical( this, SchResId( FL_VERTICAL ) )
        , m_apTitleResources( new TitleResources(this,false) )
        , m_apLegendPositionResources( new LegendPositionResources(this,xContext) )
        , m_apLegendPositionResources( new oldLegendPositionResources(this,xContext) )
        , m_aFL_Grids( this, SchResId( FL_GRIDS ) )
        , m_aCB_Grid_X( this, SchResId( CB_X_SECONDARY ) )
        , m_aCB_Grid_Y( this, SchResId( CB_Y_SECONDARY ) )
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
index 5e509b7..e5e48bf 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -36,7 +36,7 @@ namespace chart
/**
*/
class TitleResources;
class LegendPositionResources;
class oldLegendPositionResources;
class TitlesAndObjectsTabPage : public svt::OWizardPage
{
public:
@@ -60,7 +60,7 @@ protected:
    FixedLine           m_aFL_Vertical;

    boost::scoped_ptr< TitleResources >            m_apTitleResources;
    boost::scoped_ptr< LegendPositionResources >   m_apLegendPositionResources;
    boost::scoped_ptr< oldLegendPositionResources >   m_apLegendPositionResources;

    FixedLine           m_aFL_Grids;
    CheckBox            m_aCB_Grid_X;
diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx
index 5e1cfec..379efe9 100644
--- a/chart2/source/controller/inc/dlg_InsertLegend.hxx
+++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx
@@ -31,11 +31,11 @@
namespace chart
{

class LegendPositionResources;
class oldLegendPositionResources;
class SchLegendDlg : public ModalDialog
{
private:
    ::std::auto_ptr< LegendPositionResources >    m_apLegendPositionResources;
    ::std::auto_ptr< oldLegendPositionResources >    m_apLegendPositionResources;

    OKButton        aBtnOK;
    CancelButton    aBtnCancel;
diff --git a/chart2/uiconfig/ui/tp_LegendPosition.ui b/chart2/uiconfig/ui/tp_LegendPosition.ui
index 4e7cf4c..3e6f18f 100644
--- a/chart2/uiconfig/ui/tp_LegendPosition.ui
+++ b/chart2/uiconfig/ui/tp_LegendPosition.ui
@@ -7,7 +7,7 @@
    <property name="can_focus">False</property>
    <property name="border_width">6</property>
    <property name="orientation">vertical</property>
    <property name="spacing">6</property>
    <property name="spacing">12</property>
    <child>
      <object class="GtkFrame" id="framePOSITION">
        <property name="visible">True</property>
@@ -21,12 +21,82 @@
            <property name="top_padding">6</property>
            <property name="left_padding">12</property>
            <child>
              <object class="GtkBox" id="boxPOSITION">
              <object class="GtkGrid" id="grid1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="orientation">vertical</property>
                <property name="row_spacing">6</property>
                <child>
                  <placeholder/>
                  <object class="GtkRadioButton" id="left">
                    <property name="label" translatable="yes">_Left</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">False</property>
                    <property name="use_underline">True</property>
                    <property name="xalign">0</property>
                    <property name="active">True</property>
                    <property name="draw_indicator">True</property>
                    <property name="group">right</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">0</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkRadioButton" id="right">
                    <property name="label" translatable="yes">_Right</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">False</property>
                    <property name="use_underline">True</property>
                    <property name="xalign">0</property>
                    <property name="draw_indicator">True</property>
                    <property name="group">top</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">1</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkRadioButton" id="top">
                    <property name="label" translatable="yes">_Top</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">False</property>
                    <property name="use_underline">True</property>
                    <property name="xalign">0</property>
                    <property name="draw_indicator">True</property>
                    <property name="group">bottom</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">2</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkRadioButton" id="bottom">
                    <property name="label" translatable="yes">_Bottom</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="receives_default">False</property>
                    <property name="use_underline">True</property>
                    <property name="xalign">0</property>
                    <property name="draw_indicator">True</property>
                    <property name="group">left</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
                    <property name="top_attach">3</property>
                    <property name="width">1</property>
                    <property name="height">1</property>
                  </packing>
                </child>
              </object>
            </child>