[Libreoffice-commits] core.git: 2 commits - include/xmloff sc/AllLangResTarget_sc.mk sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk xmloff/source

Caolán McNamara caolanm at redhat.com
Wed Feb 5 03:37:05 PST 2014


 include/xmloff/shapeimport.hxx             |    7 
 include/xmloff/xmlictxt.hxx                |    5 
 sc/AllLangResTarget_sc.mk                  |    1 
 sc/UIConfig_scalc.mk                       |    1 
 sc/inc/sc.hrc                              |    1 
 sc/inc/scabstdlg.hxx                       |    1 
 sc/source/ui/attrdlg/scdlgfact.cxx         |   20 -
 sc/source/ui/attrdlg/scdlgfact.hxx         |    1 
 sc/source/ui/dbgui/scendlg.cxx             |  151 ++++-------
 sc/source/ui/dbgui/scendlg.hrc             |   52 ---
 sc/source/ui/dbgui/scendlg.src             |  165 ------------
 sc/source/ui/docshell/docsh4.cxx           |    2 
 sc/source/ui/inc/scendlg.hxx               |   27 --
 sc/source/ui/view/cellsh3.cxx              |    2 
 sc/uiconfig/scalc/ui/scenariodialog.ui     |  382 +++++++++++++++++++++++++++++
 xmloff/source/core/xmlictxt.cxx            |    3 
 xmloff/source/core/xmlmultiimagehelper.cxx |   11 
 xmloff/source/draw/shapeimport.cxx         |   31 ++
 xmloff/source/draw/ximpshap.cxx            |   67 +++++
 xmloff/source/draw/ximpshap.hxx            |    4 
 20 files changed, 580 insertions(+), 354 deletions(-)

New commits:
commit e401b9c8243af61d4b2889d38e8390e8971099f2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 5 10:06:56 2014 +0000

    convert scenario dialog to .ui
    
    Change-Id: I66f7fe04155ad4c6e42e6aa96bb2db71ba4f682f

diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index b312bba..e56cafc 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -53,7 +53,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
     sc/source/ui/dbgui/dpgroupdlg.src \
     sc/source/ui/dbgui/pvfundlg.src \
     sc/source/ui/dbgui/dapitype.src \
-    sc/source/ui/dbgui/scendlg.src \
     sc/source/ui/dbgui/validate.src \
     sc/source/ui/drawfunc/drformsh.src \
     sc/source/ui/drawfunc/objdraw.src \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index e0cd107..0e9c1fd 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -133,6 +133,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/rowheightdialog \
 	sc/uiconfig/scalc/ui/samplingdialog \
 	sc/uiconfig/scalc/ui/standardfilterdialog \
+	sc/uiconfig/scalc/ui/scenariodialog \
 	sc/uiconfig/scalc/ui/scgeneralpage \
 	sc/uiconfig/scalc/ui/searchresults \
 	sc/uiconfig/scalc/ui/selectdatasource \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 3bdad83..a733aec 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1014,7 +1014,6 @@
 #define RID_SCDLG_PIVOTFILTER   (SC_DIALOGS_START + 33)
 #define RID_SCDLG_PIVOT_LAYOUT  (SC_DIALOGS_START + 34)
 #define RID_SCDLG_CONSOLIDATE   (SC_DIALOGS_START + 35)
-#define RID_SCDLG_NEWSCENARIO   (SC_DIALOGS_START + 39)
 #define RID_SCDLG_INSERT_TABLE  (SC_DIALOGS_START + 42)
 
 #define RID_SCPAGE_AREAS        (SC_DIALOGS_START + 44)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 0861d60..39fd50c 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -442,7 +442,6 @@ public:
                                                                 sal_uInt16 nOrient ) = 0;
 
     virtual AbstractScNewScenarioDlg * CreateScNewScenarioDlg ( Window* pParent, const OUString& rName,
-                                                                int nId,
                                                                 sal_Bool bEdit = false, sal_Bool bSheetProtected = false ) = 0;
     virtual AbstractScShowTabDlg * CreateScShowTabDlg(Window* pParent) = 0;
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index f9e146c..381e868 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -901,23 +901,11 @@ AbstractScDPShowDetailDlg * ScAbstractDialogFactory_Impl::CreateScDPShowDetailDl
     return 0;
 }
 
-AbstractScNewScenarioDlg * ScAbstractDialogFactory_Impl::CreateScNewScenarioDlg ( Window* pParent, const OUString& rName,
-                                                                int nId,
-                                                                sal_Bool bEdit , sal_Bool bSheetProtected )
+AbstractScNewScenarioDlg * ScAbstractDialogFactory_Impl::CreateScNewScenarioDlg(Window* pParent, const OUString& rName,
+    sal_Bool bEdit, sal_Bool bSheetProtected)
 {
-    ScNewScenarioDlg * pDlg=NULL;
-    switch ( nId )
-    {
-        case RID_SCDLG_NEWSCENARIO :
-            pDlg = new ScNewScenarioDlg( pParent, rName, bEdit,bSheetProtected );
-            break;
-        default:
-            break;
-    }
-
-    if ( pDlg )
-        return new AbstractScNewScenarioDlg_Impl( pDlg );
-    return 0;
+    ScNewScenarioDlg *pDlg = new ScNewScenarioDlg(pParent, rName, bEdit, bSheetProtected);
+    return new AbstractScNewScenarioDlg_Impl( pDlg );
 }
 
 AbstractScShowTabDlg * ScAbstractDialogFactory_Impl::CreateScShowTabDlg(Window* pParent)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index c414cbe..141fd5e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -511,7 +511,6 @@ public:
                                                                 sal_uInt16 nOrient );
 
     virtual AbstractScNewScenarioDlg * CreateScNewScenarioDlg ( Window* pParent, const OUString& rName,
-                                                                int nId,
                                                                 sal_Bool bEdit = false, sal_Bool bSheetProtected = false );
     virtual AbstractScShowTabDlg * CreateScShowTabDlg(Window* pParent);
 
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index 4499e72..2d55288 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -37,35 +37,31 @@
 #include "viewdata.hxx"
 #include "document.hxx"
 #include "scresid.hxx"
-#include "scendlg.hrc"
 #include "scendlg.hxx"
 
 //========================================================================
 
 ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const OUString& rName, sal_Bool bEdit, sal_Bool bSheetProtected)
 
-    :   ModalDialog     ( pParent, ScResId( RID_SCDLG_NEWSCENARIO ) ),
-        aFlName         ( this, ScResId( FL_NAME )),
-        aEdName         ( this, ScResId( ED_NAME ) ),
-        aFlComment      ( this, ScResId( FL_COMMENT ) ),
-        aEdComment      ( this, ScResId( ED_COMMENT ) ),
-        aFlOptions      ( this, ScResId( FL_OPTIONS ) ),
-        aCbShowFrame    ( this, ScResId( CB_SHOWFRAME ) ),
-        aLbColor        ( this, ScResId( LB_COLOR ) ),
-        //aCbPrintFrame ( this, ScResId( CB_PRINTFRAME ) ),
-        aCbTwoWay       ( this, ScResId( CB_TWOWAY ) ),
-        //aCbAttrib     ( this, ScResId( CB_ATTRIB ) ),
-        //aCbValue      ( this, ScResId( CB_VALUE ) ),
-        aCbCopyAll      ( this, ScResId( CB_COPYALL ) ),
-        aCbProtect      ( this, ScResId( CB_PROTECT ) ),
-        aBtnOk          ( this, ScResId( BTN_OK ) ),
-        aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
-        aBtnHelp        ( this, ScResId( BTN_HELP ) ),
-        aDefScenarioName( rName ),
-        bIsEdit         ( bEdit )
+    : ModalDialog(pParent, "ScenarioDialog",
+        "modules/scalc/ui/scenariodialog.ui")
+    , aDefScenarioName(rName)
+    , bIsEdit(bEdit)
 {
+    get(m_pEdName, "name");
+    get(m_pEdComment, "comment");
+    Size aSize(m_pEdComment->LogicToPixel(Size(183, 46), MAP_APPFONT));
+    m_pEdComment->set_width_request(aSize.Width());
+    m_pEdComment->set_height_request(aSize.Height());
+    get(m_pCbShowFrame, "showframe");
+    get(m_pLbColor, "bordercolor");
+    get(m_pCbTwoWay, "copyback");
+    get(m_pCbCopyAll, "copysheet");
+    get(m_pCbProtect, "preventchanges");
+    get(m_pBtnOk, "ok");
+
     if (bIsEdit)
-        SetText(OUString(ScResId(STR_EDIT)));
+        SetText(get<FixedText>("alttitle")->GetText());
 
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     if ( pDocSh )
@@ -76,65 +72,45 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const OUString& rName, sal_
             XColorListRef pColorList = ((SvxColorListItem*)pItem)->GetColorList();
             if (pColorList.is())
             {
-                aLbColor.SetUpdateMode( false );
+                m_pLbColor->SetUpdateMode( false );
                 long nCount = pColorList->Count();
                 for ( long n=0; n<nCount; n++ )
                 {
                     XColorEntry* pEntry = pColorList->GetColor(n);
-                    aLbColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+                    m_pLbColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
                 }
-                aLbColor.SetUpdateMode( sal_True );
+                m_pLbColor->SetUpdateMode( sal_True );
             }
         }
     }
 
     SvtUserOptions aUserOpt;
 
-    OUString aComment(OUString(ScResId(STR_CREATEDBY)) + " " + aUserOpt.GetFirstName() + " " +aUserOpt.GetLastName()
-              + ", " + OUString(ScResId(STR_ON)) + " " + ScGlobal::GetpLocaleData()->getDate(Date(Date::SYSTEM))
-              + ", " + ScGlobal::GetpLocaleData()->getTime(Time(Time::SYSTEM)));
-
-    aEdComment.SetText(aComment);
-    aEdName.SetText(rName);
-    aBtnOk.SetClickHdl( LINK( this, ScNewScenarioDlg, OkHdl ) );
-    aCbShowFrame.SetClickHdl( LINK( this, ScNewScenarioDlg, EnableHdl ) );
+    OUString sCreatedBy(get<FixedText>("createdft")->GetText());
+    OUString sOn(get<FixedText>("onft")->GetText());
 
-    aLbColor.SetAccessibleName(OUString(ScResId( STR_COLOR ) ));
+    OUString aComment(sCreatedBy + " " + aUserOpt.GetFirstName() + " " +aUserOpt.GetLastName()
+              + ", " + sOn + " " + ScGlobal::GetpLocaleData()->getDate(Date(Date::SYSTEM))
+              + ", " + ScGlobal::GetpLocaleData()->getTime(Time(Time::SYSTEM)));
 
-    FreeResource();
+    m_pEdComment->SetText(aComment);
+    m_pEdName->SetText(rName);
+    m_pBtnOk->SetClickHdl( LINK( this, ScNewScenarioDlg, OkHdl ) );
+    m_pCbShowFrame->SetClickHdl( LINK( this, ScNewScenarioDlg, EnableHdl ) );
 
-    aLbColor.SelectEntry( Color( COL_LIGHTGRAY ) );
-    aCbShowFrame.Check(sal_True);
-    //aCbPrintFrame.Check(sal_True);
-    aCbTwoWay.Check(sal_True);
-    //aCbAttrib.Check(sal_False);
-    //aCbValue.Check(sal_False);
-    aCbCopyAll.Check(false);
-    aCbProtect.Check(sal_True);
+    m_pLbColor->SelectEntry( Color( COL_LIGHTGRAY ) );
+    m_pCbShowFrame->Check(sal_True);
+    m_pCbTwoWay->Check(sal_True);
+    m_pCbCopyAll->Check(false);
+    m_pCbProtect->Check(sal_True);
 
     if (bIsEdit)
-        aCbCopyAll.Enable(false);
+        m_pCbCopyAll->Enable(false);
     // If the Sheet is protected then we disable the Scenario Protect input
     // and default it to true above. Note we are in 'Add' mode here as: if
     // Sheet && scenario protection are true, then we cannot edit this dialog.
     if (bSheetProtected)
-        aCbProtect.Enable(false);
-
-    //! die drei funktionieren noch nicht...
-    /*
-    aCbPrintFrame.Enable(sal_False);
-    aCbAttrib.Enable(sal_False);
-    aCbValue.Enable(sal_False);
-    */
-
-    aEdComment.SetAccessibleRelationMemberOf(&aFlComment);
-    aLbColor.SetAccessibleRelationLabeledBy(&aCbShowFrame);
-}
-
-//------------------------------------------------------------------------
-
-ScNewScenarioDlg::~ScNewScenarioDlg()
-{
+        m_pCbProtect->Enable(false);
 }
 
 //------------------------------------------------------------------------
@@ -142,31 +118,21 @@ ScNewScenarioDlg::~ScNewScenarioDlg()
 void ScNewScenarioDlg::GetScenarioData( OUString& rName, OUString& rComment,
                                         Color& rColor, sal_uInt16& rFlags ) const
 {
-    rComment = aEdComment.GetText();
-    rName    = aEdName.GetText();
+    rComment = m_pEdComment->GetText();
+    rName    = m_pEdName->GetText();
 
     if (rName.isEmpty())
         rName = aDefScenarioName;
 
-    rColor = aLbColor.GetSelectEntryColor();
+    rColor = m_pLbColor->GetSelectEntryColor();
     sal_uInt16 nBits = 0;
-    if (aCbShowFrame.IsChecked())
+    if (m_pCbShowFrame->IsChecked())
         nBits |= SC_SCENARIO_SHOWFRAME;
-    /*
-    if (aCbPrintFrame.IsChecked())
-        nBits |= SC_SCENARIO_PRINTFRAME;
-    */
-    if (aCbTwoWay.IsChecked())
+    if (m_pCbTwoWay->IsChecked())
         nBits |= SC_SCENARIO_TWOWAY;
-    /*
-    if (aCbAttrib.IsChecked())
-        nBits |= SC_SCENARIO_ATTRIB;
-    if (aCbValue.IsChecked())
-        nBits |= SC_SCENARIO_VALUE;
-    */
-    if (aCbCopyAll.IsChecked())
+    if (m_pCbCopyAll->IsChecked())
         nBits |= SC_SCENARIO_COPYALL;
-    if (aCbProtect.IsChecked())
+    if (m_pCbProtect->IsChecked())
         nBits |= SC_SCENARIO_PROTECT;
     rFlags = nBits;
 }
@@ -174,38 +140,35 @@ void ScNewScenarioDlg::GetScenarioData( OUString& rName, OUString& rComment,
 void ScNewScenarioDlg::SetScenarioData( const OUString& rName, const OUString& rComment,
                                         const Color& rColor, sal_uInt16 nFlags )
 {
-    aEdComment.SetText(rComment);
-    aEdName.SetText(rName);
-    aLbColor.SelectEntry(rColor);
-
-    aCbShowFrame.Check ( (nFlags & SC_SCENARIO_SHOWFRAME)  != 0 );
-    EnableHdl( &aCbShowFrame );
-    //aCbPrintFrame.Check( (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
-    aCbTwoWay.Check    ( (nFlags & SC_SCENARIO_TWOWAY)     != 0 );
-    //aCbAttrib.Check    ( (nFlags & SC_SCENARIO_ATTRIB)     != 0 );
-    //aCbValue.Check     ( (nFlags & SC_SCENARIO_VALUE)      != 0 );
+    m_pEdComment->SetText(rComment);
+    m_pEdName->SetText(rName);
+    m_pLbColor->SelectEntry(rColor);
+
+    m_pCbShowFrame->Check ( (nFlags & SC_SCENARIO_SHOWFRAME)  != 0 );
+    EnableHdl(m_pCbShowFrame);
+    m_pCbTwoWay->Check    ( (nFlags & SC_SCENARIO_TWOWAY)     != 0 );
     //  CopyAll nicht
-    aCbProtect.Check    ( (nFlags & SC_SCENARIO_PROTECT)     != 0 );
+    m_pCbProtect->Check    ( (nFlags & SC_SCENARIO_PROTECT)     != 0 );
 }
 
 //------------------------------------------------------------------------
 
 IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
 {
-    OUString      aName = comphelper::string::strip(aEdName.GetText(), ' ');
+    OUString      aName = comphelper::string::strip(m_pEdName->GetText(), ' ');
     ScDocument* pDoc    = ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument();
 
-    aEdName.SetText( aName );
+    m_pEdName->SetText( aName );
 
     if ( !pDoc->ValidTabName( aName ) )
     {
         InfoBox( this, ScGlobal::GetRscString( STR_INVALIDTABNAME ) ).Execute();
-        aEdName.GrabFocus();
+        m_pEdName->GrabFocus();
     }
     else if ( !bIsEdit && !pDoc->ValidNewTabName( aName ) )
     {
         InfoBox( this, ScGlobal::GetRscString( STR_NEWTABNAMENOTUNIQUE ) ).Execute();
-        aEdName.GrabFocus();
+        m_pEdName->GrabFocus();
     }
     else
         EndDialog( RET_OK );
@@ -218,8 +181,8 @@ IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
 
 IMPL_LINK( ScNewScenarioDlg, EnableHdl, CheckBox *, pBox )
 {
-    if( pBox == &aCbShowFrame )
-        aLbColor.Enable( aCbShowFrame.IsChecked() );
+    if (pBox == m_pCbShowFrame)
+        m_pLbColor->Enable( m_pCbShowFrame->IsChecked() );
     return 0;
 }
 
diff --git a/sc/source/ui/dbgui/scendlg.hrc b/sc/source/ui/dbgui/scendlg.hrc
deleted file mode 100644
index 2df24df..0000000
--- a/sc/source/ui/dbgui/scendlg.hrc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include "sc.hrc"
-
-#define BTN_OK                  1
-#define BTN_CANCEL              2
-#define BTN_HELP                3
-
-#define FL_NAME                 10
-#define ED_NAME                 11
-#define FL_COMMENT              12
-#define ED_COMMENT              13
-
-#define FL_OPTIONS              20
-#define CB_SHOWFRAME            21
-#define LB_COLOR                22
-#define CB_PRINTFRAME           23
-#define CB_TWOWAY               24
-#define CB_ATTRIB               25
-#define CB_VALUE                26
-#define CB_COPYALL              27
-#define CB_PROTECT              28
-
-#ifdef STR_ON
-#undef STR_ON
-#endif
-#ifdef STR_EDIT
-#undef STR_EDIT
-#endif
-
-#define STR_CREATEDBY           31
-#define STR_ON                  32
-#define STR_EDIT                33
-#define STR_COLOR       34
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/scendlg.src b/sc/source/ui/dbgui/scendlg.src
deleted file mode 100644
index a80ff01..0000000
--- a/sc/source/ui/dbgui/scendlg.src
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "scendlg.hrc"
-ModalDialog RID_SCDLG_NEWSCENARIO
-{
-    HelpID = "sc:ModalDialog:RID_SCDLG_NEWSCENARIO";
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 260 , 165 ) ;
-    Text [ en-US ] = "Create Scenario" ;
-    Moveable = TRUE ;
-    OKButton BTN_OK
-    {
-        Pos = MAP_APPFONT ( 204 , 6 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton BTN_CANCEL
-    {
-        Pos = MAP_APPFONT ( 204 , 23 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    HelpButton BTN_HELP
-    {
-        Pos = MAP_APPFONT ( 204 , 43 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    MultiLineEdit ED_COMMENT
-    {
-        HelpID = "sc:MultiLineEdit:RID_SCDLG_NEWSCENARIO:ED_COMMENT";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 43 ) ;
-        Size = MAP_APPFONT ( 183 , 46 ) ;
-        TabStop = TRUE ;
-        MaxTextLength = 512 ;
-        VScroll = TRUE ;
-        IgnoreTab = TRUE ;
-    };
-    Edit ED_NAME
-    {
-        HelpID = "sc:Edit:RID_SCDLG_NEWSCENARIO:ED_NAME";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 14 ) ;
-        Size = MAP_APPFONT ( 183 , 12 ) ;
-        TabStop = TRUE ;
-    };
-    CheckBox CB_SHOWFRAME
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_SHOWFRAME";
-        Pos = MAP_APPFONT ( 12 , 107 ) ;
-        Size = MAP_APPFONT ( 109 , 10 ) ;
-        Text [ en-US ] = "~Display border";
-    };
-    ListBox LB_COLOR
-    {
-        HelpID = "sc:ListBox:RID_SCDLG_NEWSCENARIO:LB_COLOR";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 125 , 105 ) ;
-        Size = MAP_APPFONT ( 70 , 86 ) ;
-        DropDown = TRUE ;
-        DDExtraWidth = TRUE ;
-    };
-    CheckBox CB_PRINTFRAME
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_PRINTFRAME";
-        Hide = TRUE ;
-        Pos = MAP_APPFONT ( 121 , 243 ) ;
-        Size = MAP_APPFONT ( 83 , 10 ) ;
-        Text [ en-US ] = "Print border" ;
-    };
-    CheckBox CB_TWOWAY
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_TWOWAY";
-        Pos = MAP_APPFONT ( 12 , 121 ) ;
-        Size = MAP_APPFONT ( 183 , 10 ) ;
-        Text [ en-US ] = "Copy ~back" ;
-    };
-    CheckBox CB_ATTRIB
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_ATTRIB";
-        Hide = TRUE ;
-        Pos = MAP_APPFONT ( 20 , 243 ) ;
-        Size = MAP_APPFONT ( 83 , 10 ) ;
-        Text [ en-US ] = "Attributes" ;
-    };
-    CheckBox CB_VALUE
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_VALUE";
-        Hide = TRUE ;
-        Pos = MAP_APPFONT ( 230 , 243 ) ;
-        Size = MAP_APPFONT ( 83 , 10 ) ;
-        Text [ en-US ] = "Copy values only" ;
-    };
-    CheckBox CB_COPYALL
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_COPYALL";
-        Pos = MAP_APPFONT ( 12 , 135 ) ;
-        Size = MAP_APPFONT ( 183 , 10 ) ;
-        Text [ en-US ] = "Copy ~entire sheet" ;
-    };
-    CheckBox CB_PROTECT
-    {
-        HelpID = "sc:CheckBox:RID_SCDLG_NEWSCENARIO:CB_PROTECT";
-        Pos = MAP_APPFONT ( 12 , 149 ) ;
-        Size = MAP_APPFONT ( 183 , 10 ) ;
-        Text [ en-US ] = "~Prevent changes" ;
-    };
-    String STR_EDIT
-    {
-        Text [ en-US ] = "Edit Scenario" ;
-    };
-    String STR_CREATEDBY
-    {
-        Text [ en-US ] = "Created by" ;
-    };
-    String STR_ON
-    {
-        Text [ en-US ] = "on" ;
-    };
-    String STR_COLOR
-    {
-        Text [ en-US ] = "Display border in" ;
-    };
-    FixedLine FL_NAME
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 192 , 8 ) ;
-        Text [ en-US ] = "~Name of scenario";
-    };
-    FixedLine FL_COMMENT
-    {
-        Pos = MAP_APPFONT ( 6 , 32 ) ;
-        Size = MAP_APPFONT ( 192 , 8 ) ;
-        Text [ en-US ] = "~Comment";
-    };
-    FixedLine FL_OPTIONS
-    {
-        Pos = MAP_APPFONT ( 6 , 95 ) ;
-        Size = MAP_APPFONT ( 192 , 8 ) ;
-        Text [ en-US ] = "Settings";
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 8c4039f..6cbd08b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -869,7 +869,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                                 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                                AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg( GetActiveDialogParent(), aName, RID_SCDLG_NEWSCENARIO, true,bSheetProtected);
+                                AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg(GetActiveDialogParent(), aName, true, bSheetProtected);
                                 OSL_ENSURE(pNewDlg, "Dialog create fail!");
                                 pNewDlg->SetScenarioData( aName, aComment, aColor, nFlags );
                                 if ( pNewDlg->Execute() == RET_OK )
diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx
index dbbbe13..ae5444a 100644
--- a/sc/source/ui/inc/scendlg.hxx
+++ b/sc/source/ui/inc/scendlg.hxx
@@ -33,8 +33,7 @@
 class ScNewScenarioDlg : public ModalDialog
 {
 public:
-        ScNewScenarioDlg( Window* pParent, const OUString& rName, sal_Bool bEdit = false, sal_Bool bSheetProtected = false );
-        ~ScNewScenarioDlg();
+    ScNewScenarioDlg(Window* pParent, const OUString& rName, sal_Bool bEdit = false, sal_Bool bSheetProtected = false);
 
     void SetScenarioData( const OUString& rName, const OUString& rComment,
                           const Color& rColor, sal_uInt16 nFlags );
@@ -43,22 +42,14 @@ public:
                           Color& rColor, sal_uInt16& rFlags ) const;
 
 private:
-    FixedLine           aFlName;
-    Edit                aEdName;
-    FixedLine           aFlComment;
-    MultiLineEdit       aEdComment;
-    FixedLine           aFlOptions;
-    CheckBox            aCbShowFrame;
-    ColorListBox        aLbColor;
-    //CheckBox          aCbPrintFrame;
-    CheckBox            aCbTwoWay;
-    //CheckBox          aCbAttrib;
-    //CheckBox          aCbValue;
-    CheckBox            aCbCopyAll;
-    CheckBox            aCbProtect;
-    OKButton            aBtnOk;
-    CancelButton        aBtnCancel;
-    HelpButton          aBtnHelp;
+    Edit*               m_pEdName;
+    VclMultiLineEdit*   m_pEdComment;
+    CheckBox*           m_pCbShowFrame;
+    ColorListBox*       m_pLbColor;
+    CheckBox*           m_pCbTwoWay;
+    CheckBox*           m_pCbCopyAll;
+    CheckBox*           m_pCbProtect;
+    OKButton*           m_pBtnOk;
     const OUString      aDefScenarioName;
     sal_Bool            bIsEdit;
 
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index a3c7893..7b1a54f 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -493,7 +493,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                             ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                             OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                            AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg( pTabViewShell->GetDialogParent(), aName, RID_SCDLG_NEWSCENARIO, false,bSheetProtected);
+                            AbstractScNewScenarioDlg* pNewDlg = pFact->CreateScNewScenarioDlg(pTabViewShell->GetDialogParent(), aName, false, bSheetProtected);
                             OSL_ENSURE(pNewDlg, "Dialog create fail!");
                             if ( pNewDlg->Execute() == RET_OK )
                             {
diff --git a/sc/uiconfig/scalc/ui/scenariodialog.ui b/sc/uiconfig/scalc/ui/scenariodialog.ui
new file mode 100644
index 0000000..f32e353
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/scenariodialog.ui
@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 on Wed Feb  5 11:06:31 2014 -->
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkDialog" id="ScenarioDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Create Scenario</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkEntry" id="name">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Name of scenario</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </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="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkTextView" id="comment:border">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="accepts_tab">False</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Comment</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </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="GtkFrame" id="frame3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkGrid" id="grid2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="copyback">
+                            <property name="label" translatable="yes">Copy _back</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>
+                          </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="GtkCheckButton" id="copysheet">
+                            <property name="label" translatable="yes">Copy _entire sheet</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>
+                          </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="GtkCheckButton" id="preventchanges">
+                            <property name="label" translatable="yes">_Prevent changes</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>
+                          </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>
+                        <child>
+                          <object class="GtkGrid" id="grid3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="column_spacing">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="showframe">
+                                <property name="label" translatable="yes">_Display border</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>
+                                <accessibility>
+                                  <relation type="label-for" target="bordercolor"/>
+                                </accessibility>
+                              </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="svtlo-ColorListBox" id="bordercolor">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <accessibility>
+                                  <relation type="labelled-by" target="showframe"/>
+                                </accessibility>
+                                <child internal-child="accessible">
+                                  <object class="AtkObject" id="bordercolor-atkobject">
+                                    <property name="AtkObject::accessible-name" translatable="yes">Display border in</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                          </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>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Settings</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </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="GtkLabel" id="alttitle">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Edit Scenario</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>
+            <child>
+              <object class="GtkGrid" id="grid4">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="createdft">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Created by</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="GtkLabel" id="onft">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">on</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>
commit 258e6f93e81539d90b23f45224dd225a6e20ab0d
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Feb 4 17:42:05 2014 +0000

    Resolves: #i124143# for draw:frame containing multiple draw:image...
    
    and draw:glue-point it is necessary to move the GluePoints from the last
    draw:image where they were automatically imported to the surviving one if these
    are different
    
    (cherry picked from commit c011af1087411a9bacd29cd479c807e698b2e92c)
    
    Conflicts:
    	xmloff/inc/xmloff/xmlictxt.hxx
    	xmloff/source/core/xmlmultiimagehelper.cxx
    	xmloff/source/draw/ximpshap.cxx
    	xmloff/source/draw/ximpshap.hxx
    
    Change-Id: I8f6c875767e9cbfee74838742401356df002b051

diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
index 62f26af..c54a57f 100644
--- a/include/xmloff/shapeimport.hxx
+++ b/include/xmloff/shapeimport.hxx
@@ -387,12 +387,17 @@ public:
     void addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
                               sal_Int32 nSourceId, sal_Int32 nDestinnationId );
 
+    /** find mapping for given DestinationID. This allows to extract the original draw:id imported with a draw:glue-point */
+    sal_Int32 findGluePointMapping(
+        const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
+        sal_Int32 nDestinnationId ) const;
+
     /** moves all current DestinationId's for rXShape by n */
     void moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n );
 
     /** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after
         inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */
-    sal_Int32 getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId );
+    sal_Int32 getGluePointId( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId );
 
     /** this method must be calling before the first shape is imported for the given page.
         Calls to this method can be nested */
diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx
index 0fb72d1..afa9698 100644
--- a/include/xmloff/xmlictxt.hxx
+++ b/include/xmloff/xmlictxt.hxx
@@ -89,6 +89,11 @@ public:
     /** This method is called for all characters that are contained in the
      * current element. The default is to ignore them. */
     virtual void Characters( const OUString& rChars );
+
+    // #i124143# allow to copy evtl. useful data from another temporary import context, e.g. used to
+    // support multiple images and to rescue evtl. GluePoints imported with one of the
+    // to be deprecated contents
+    virtual void onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate );
 };
 
 SV_DECL_REF( SvXMLImportContext )
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index f748d04..e1303fe 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -69,5 +69,8 @@ void SvXMLImportContext::Characters( const OUString& )
 {
 }
 
+void SvXMLImportContext::onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& )
+{
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx
index 5445b6f..8ada292 100644
--- a/xmloff/source/core/xmlmultiimagehelper.cxx
+++ b/xmloff/source/core/xmlmultiimagehelper.cxx
@@ -120,7 +120,16 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages()
         // remove the rest from parent
         for(a = 0; a < maImplContextVector.size(); a++)
         {
-            removeGraphicFromImportContext(**maImplContextVector[a]);
+            SvXMLImportContext& rCandidate = **maImplContextVector[a];
+
+            if(pContext)
+            {
+                // #i124143# evtl. copy imported GluePoints before deprecating
+                // this graphic and context
+                pContext->onDemandRescueUsefulDataFromTemporary(rCandidate);
+            }
+
+            removeGraphicFromImportContext(rCandidate);
         }
     }
     else if (maImplContextVector.size() == 1)
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 33fcbb3..4dbb85f 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -1031,6 +1031,35 @@ void XMLShapeImportHelper::addGluePointMapping( com::sun::star::uno::Reference<
         mpPageContext->maShapeGluePointsMap[xShape][nSourceId] = nDestinnationId;
 }
 
+/** find mapping for given DestinationID. This allows to extract the original draw:id imported with a draw:glue-point */
+sal_Int32 XMLShapeImportHelper::findGluePointMapping(
+    const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
+    sal_Int32 nDestinnationId ) const
+{
+    if( mpPageContext )
+    {
+        ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) );
+
+        if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+        {
+            GluePointIdMap::iterator aShapeIdIter = (*aShapeIter).second.begin();
+            GluePointIdMap::iterator aShapeIdEnd  = (*aShapeIter).second.end();
+
+            while ( aShapeIdIter != aShapeIdEnd )
+            {
+                if ( (*aShapeIdIter).second == nDestinnationId )
+                {
+                    return (*aShapeIdIter).first;
+                }
+
+                aShapeIdIter++;
+            }
+        }
+    }
+
+    return -1;
+}
+
 /** moves all current DestinationId's by n */
 void XMLShapeImportHelper::moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n )
 {
@@ -1053,7 +1082,7 @@ void XMLShapeImportHelper::moveGluePointMapping( const com::sun::star::uno::Refe
 
 /** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after
     inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */
-sal_Int32 XMLShapeImportHelper::getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId )
+sal_Int32 XMLShapeImportHelper::getGluePointId( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId )
 {
     if( mpPageContext )
     {
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3e51b12..80e2df9 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -917,6 +917,73 @@ sal_Bool SdXMLShapeContext::isPresentationShape() const
     return sal_False;
 }
 
+void SdXMLShapeContext::onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate )
+{
+    const SdXMLShapeContext* pCandidate = dynamic_cast< const SdXMLShapeContext* >(&rCandidate);
+
+    if(!mxGluePoints.is() && pCandidate)
+    {
+        // try to rescue GluePoints from rCandidate to local if we not yet have GluePoints by copying them
+        uno::Reference< drawing::XGluePointsSupplier > xSourceSupplier( pCandidate->getShape(), uno::UNO_QUERY );
+        if( !xSourceSupplier.is() )
+            return;
+
+        uno::Reference< container::XIdentifierAccess > xSourceGluePoints( xSourceSupplier->getGluePoints(), uno::UNO_QUERY );
+        if( !xSourceGluePoints.is() )
+            return;
+
+        uno::Sequence< sal_Int32 > aSourceIdSequence( xSourceGluePoints->getIdentifiers() );
+        const sal_Int32 nSourceCount(aSourceIdSequence.getLength());
+        UniReference< XMLShapeImportHelper > xSourceShapeImportHelper(const_cast< SdXMLShapeContext* >(pCandidate)->GetImport().GetShapeImport());
+
+        if(nSourceCount)
+        {
+            // rCandidate has GluePoints; prepare the GluePoint container for the local shape
+            uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
+            if( !xSupplier.is() )
+                return;
+
+            mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() );
+
+            if( !mxGluePoints.is() )
+                return;
+
+            drawing::GluePoint2 aSourceGluePoint;
+
+            for( sal_Int32 nSourceIndex(0); nSourceIndex < nSourceCount; nSourceIndex++ )
+            {
+                const sal_Int32 nSourceIdentifier = aSourceIdSequence[nSourceIndex];
+
+                // loop over GluePoints which are UserDefined (avoid the auto mapped ones)
+                if((xSourceGluePoints->getByIdentifier( nSourceIdentifier ) >>= aSourceGluePoint)
+                    && aSourceGluePoint.IsUserDefined)
+                {
+                    // get original mappingID back, this is the draw:id imported with a draw:glue-point
+                    const sal_Int32 nDestinnationId = xSourceShapeImportHelper->findGluePointMapping(
+                        pCandidate->getShape(),
+                        nSourceIdentifier );
+
+                    if(-1 != nSourceIdentifier)
+                    {
+                        // if we got that we are able to add a copy of that GluePoint to the local
+                        // context and xShape since we have all information that the source shape
+                        // and context had at import time
+                        try
+                        {
+                            const sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aSourceGluePoint ) );
+                            GetImport().GetShapeImport()->addGluePointMapping( mxShape, nDestinnationId, nInternalId );
+                        }
+                        catch (const uno::Exception& e)
+                        {
+                            SAL_WARN("xmloff", "exception during setting of glue points: " << e.Message);
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
 TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
 
 SdXMLRectShapeContext::SdXMLRectShapeContext(
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index b07a207..a4b8786 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -115,6 +115,10 @@ public:
 
     // this is called from the parent group for each unparsed attribute in the attribute list
     virtual void processAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue );
+
+    // allow to copy evtl. useful data from another temporary import context, e.g. used to
+    // support multiple images
+    virtual void onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate );
 };
 
 // draw:rect context


More information about the Libreoffice-commits mailing list