[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - padmin/source sfx2/inc sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 14 04:49:27 PST 2012


 padmin/source/rtsetup.src         |    2 
 sfx2/inc/sfx2/sfxdlg.hxx          |   20 ++-
 sfx2/inc/sfx2/tabdlg.hxx          |    8 +
 sw/inc/swabstdlg.hxx              |    2 
 sw/source/ui/app/docst.cxx        |  202 ++++++++++++++++++++++----------------
 sw/source/ui/dialog/swdlgfact.cxx |   30 +++--
 sw/source/ui/dialog/swdlgfact.hxx |   19 +++
 sw/source/ui/fmtui/tmpdlg.cxx     |   12 --
 sw/source/ui/inc/tmpdlg.hxx       |    1 
 9 files changed, 176 insertions(+), 120 deletions(-)

New commits:
commit 012c62b9ae04404349b8595e4408e9f63ec52164
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 14 12:47:41 2012 +0000

    ps level 2 and level 3 both assigned the id for level 2
    
    Change-Id: Ia35c9fbcc023d29a5a0ecff04fa688aa00ce30e8
    (cherry picked from commit f350e8ebe9a0aea0c13db3f6d8b5a35f20145e09)
    
    Signed-off-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/padmin/source/rtsetup.src b/padmin/source/rtsetup.src
index b75a1a3..9449cfd 100644
--- a/padmin/source/rtsetup.src
+++ b/padmin/source/rtsetup.src
@@ -190,7 +190,7 @@ TabPage RID_RTS_DEVICEPAGE
             < "PostScript (Level from driver)" ; 1; > ;
             < "PostScript Level 1" ; 2; > ;
             < "PostScript Level 2"; 3; > ;
-            < "PostScript Level 3"; 3; > ;
+            < "PostScript Level 3"; 4; > ;
             < "PDF"; 10; > ;
         };
     };
commit cafa391c032dbba6869bbf56132025240c34c123
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 13 10:12:13 2012 +0000

    Related: fdo#38606 keep style dialog open when apply is clicked
    
    i.e. don't close and reopen, just stay open
    
    Change-Id: I11cdc492e3c4adfb75c9a0dfa52e5ba351914858

diff --git a/sfx2/inc/sfx2/sfxdlg.hxx b/sfx2/inc/sfx2/sfxdlg.hxx
index 3585645..0465dbb 100644
--- a/sfx2/inc/sfx2/sfxdlg.hxx
+++ b/sfx2/inc/sfx2/sfxdlg.hxx
@@ -55,7 +55,7 @@ namespace com { namespace sun { namespace star { namespace frame {
     class XModel;
 } } } }
 
-class SfxAbstractDialog : public VclAbstractDialog
+class SfxAbstractDialog : virtual public VclAbstractDialog
 {
 public:
     virtual const SfxItemSet*   GetOutputItemSet() const = 0;
@@ -63,15 +63,21 @@ public:
     virtual String              GetText() const = 0;
 };
 
-class SfxAbstractTabDialog : public SfxAbstractDialog
+class SfxAbstractTabDialog : virtual public SfxAbstractDialog
 {
 public:
     virtual void                SetCurPageId( sal_uInt16 nId ) = 0;
-    virtual const sal_uInt16*       GetInputRanges( const SfxItemPool& ) = 0;
+    virtual const sal_uInt16*   GetInputRanges( const SfxItemPool& ) = 0;
     virtual void                SetInputSet( const SfxItemSet* pInSet ) = 0;
 };
 
-class SfxAbstractInsertObjectDialog : public VclAbstractDialog
+class SfxAbstractApplyTabDialog : virtual public SfxAbstractTabDialog
+{
+public:
+    virtual void                SetApplyHdl( const Link& rLink ) = 0;
+};
+
+class SfxAbstractInsertObjectDialog : virtual public VclAbstractDialog
 {
 public:
     virtual com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject()=0;
@@ -79,7 +85,7 @@ public:
     virtual sal_Bool IsCreateNew()=0;
 };
 
-class SfxAbstractPasteDialog : public VclAbstractDialog
+class SfxAbstractPasteDialog : virtual public VclAbstractDialog
 {
 public:
     virtual void Insert( SotFormatStringId nFormat, const String & rFormatName ) = 0;
@@ -89,11 +95,11 @@ public:
                         const TransferableObjectDescriptor* pDesc=0 ) = 0;
 };
 
-class SfxAbstractLinksDialog : public VclAbstractDialog
+class SfxAbstractLinksDialog : virtual public VclAbstractDialog
 {
 };
 
-class AbstractScriptSelectorDialog : public VclAbstractDialog
+class AbstractScriptSelectorDialog : virtual public VclAbstractDialog
 {
 public:
     virtual String              GetScriptURL() const = 0;
diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx
index c3e010a..164dae3 100644
--- a/sfx2/inc/sfx2/tabdlg.hxx
+++ b/sfx2/inc/sfx2/tabdlg.hxx
@@ -201,7 +201,13 @@ public:
     void                SetApplyHandler(const Link& _rHdl);
 
     SAL_DLLPRIVATE void Start_Impl();
-    SAL_DLLPRIVATE sal_Bool OK_Impl() { return PrepareLeaveCurrentPage(); }
+    bool OK_Impl()
+    {
+        bool bRet = PrepareLeaveCurrentPage();
+        if (bRet)
+            Ok();
+        return bRet;
+    }
 };
 
 namespace sfx { class ItemConnectionBase; }
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 5355b97..c0e1bc8 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -416,7 +416,7 @@ public:
                                                 sal_Bool            bFmt     = sal_False,
                                                 sal_uInt16          nDefPage = 0,
                                                 const String*   pFmtStr  = 0) = 0;  //add for SwFrmDlg
-    virtual SfxAbstractTabDialog*       CreateTemplateDialog( int nResId,
+    virtual SfxAbstractApplyTabDialog*  CreateTemplateDialog(
                                                 Window*             pParent,
                                                 SfxStyleSheetBase&  rBase,
                                                 sal_uInt16              nRegion,
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 3685eb1..ad8c702 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -497,6 +497,118 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 
 }
 
+class ApplyStyle
+{
+public:
+    ApplyStyle(SwDocShell &rDocSh, bool bNew, SfxStyleSheetBase* pStyle,
+        sal_uInt16 nRet, rtl::Reference< SwDocStyleSheet > xTmp,
+        sal_uInt16 nFamily, SfxAbstractApplyTabDialog *pDlg,
+        rtl::Reference< SfxStyleSheetBasePool > xBasePool,
+        bool bModified)
+        : m_rDocSh(rDocSh)
+        , m_bNew(bNew)
+        , m_pStyle(pStyle)
+        , m_nRet(nRet)
+        , m_xTmp(xTmp)
+        , m_nFamily(nFamily)
+        , m_pDlg(pDlg)
+        , m_xBasePool(xBasePool)
+        , m_bModified(bModified)
+    {
+    }
+    DECL_LINK( ApplyHdl, void* );
+    void apply()
+    {
+        ApplyHdl(NULL);
+    }
+    sal_uInt16 getRet() const { return m_nRet; }
+private:
+    SwDocShell &m_rDocSh;
+    bool m_bNew;
+    SfxStyleSheetBase* m_pStyle;
+    sal_uInt16 m_nRet;
+    rtl::Reference< SwDocStyleSheet > m_xTmp;
+    sal_uInt16 m_nFamily;
+    SfxAbstractApplyTabDialog *m_pDlg;
+    rtl::Reference< SfxStyleSheetBasePool > m_xBasePool;
+    bool m_bModified;
+};
+
+IMPL_LINK_NOARG(ApplyStyle, ApplyHdl)
+{
+    SwWrtShell* pWrtShell = m_rDocSh.GetWrtShell();
+    SwDoc* pDoc = m_rDocSh.GetDoc();
+    SwView* pView = m_rDocSh.GetView();
+
+    pWrtShell->StartAllAction();
+
+    // newly set the mask only with paragraph-templates
+    if( m_bNew )
+    {
+        m_nRet = SFX_STYLE_FAMILY_PARA == m_pStyle->GetFamily()
+                ? m_xTmp->GetMask()
+                : SFXSTYLEBIT_USERDEF;
+    }
+    else if( m_pStyle->GetMask() != m_xTmp->GetMask() )
+        m_nRet = m_xTmp->GetMask();
+
+    if( SFX_STYLE_FAMILY_PARA == m_nFamily )
+    {
+        SfxItemSet aSet( *m_pDlg->GetOutputItemSet() );
+        ::SfxToSwPageDescAttr( *pWrtShell, aSet  );
+        // reset indent attributes at paragraph style, if a list style
+        // will be applied and no indent attributes will be applied.
+        m_xTmp->SetItemSet( aSet, true );
+    }
+    else
+    {
+        if(SFX_STYLE_FAMILY_PAGE == m_nFamily)
+        {
+            static const sal_uInt16 aInval[] = {
+                SID_IMAGE_ORIENTATION,
+                SID_ATTR_CHAR_FONT,
+                FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0};
+            pView->GetViewFrame()->GetBindings().Invalidate(aInval);
+        }
+        SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() );
+        if( SFX_STYLE_FAMILY_CHAR == m_nFamily )
+        {
+            const SfxPoolItem *pTmpBrush;
+            if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
+                sal_False, &pTmpBrush ) )
+            {
+                SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+                aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+                aTmpSet.Put( aTmpBrush );
+            }
+            aTmpSet.ClearItem( RES_BACKGROUND );
+        }
+        m_xTmp->SetItemSet( aTmpSet );
+
+        if( SFX_STYLE_FAMILY_PAGE == m_nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
+        {
+            const SfxPoolItem *pItem = NULL;
+            if( aTmpSet.GetItemState( m_rDocSh.GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False ) , sal_True, &pItem ) == SFX_ITEM_SET )
+                SwChartHelper::DoUpdateAllCharts( pDoc );
+        }
+    }
+    if(SFX_STYLE_FAMILY_PAGE == m_nFamily)
+        pView->InvalidateRulerPos();
+
+    if( m_bNew )
+        m_xBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *m_xTmp.get() ) );
+
+    pDoc->SetModified();
+    if( !m_bModified )    // Bug 57028
+    {
+        pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
+    }
+
+    pWrtShell->EndAllAction();
+
+    return m_nRet;
+}
+
 /*--------------------------------------------------------------------
     Description:    Edit
  --------------------------------------------------------------------*/
@@ -654,86 +766,16 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn
         SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
         OSL_ENSURE(pFact, "Dialogdiet fail!");
-        SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE,
+        SfxAbstractApplyTabDialog* pDlg = pFact->CreateTemplateDialog(
                                                     0, *(xTmp.get()), nFamily, nPageId,
                                                     pActShell ? pActShell : pWrtShell, bNew);
         OSL_ENSURE(pDlg, "Dialogdiet fail!");
-        while (true)
-        {
-            short nButton = pDlg->Execute();
-            if(RET_OK == nButton || RET_APPLY_TEMPLATE == nButton)
-        {
-            GetWrtShell()->StartAllAction();
-
-            // newly set the mask only with paragraph-templates
-            if( bNew )
-            {
-                nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
-                        ? xTmp->GetMask()
-                        : SFXSTYLEBIT_USERDEF;
-            }
-            else if( pStyle->GetMask() != xTmp->GetMask() )
-                nRet = xTmp->GetMask();
-
-            if( SFX_STYLE_FAMILY_PARA == nFamily )
-            {
-                SfxItemSet aSet( *pDlg->GetOutputItemSet() );
-                ::SfxToSwPageDescAttr( *GetWrtShell(), aSet  );
-                // reset indent attributes at paragraph style, if a list style
-                // will be applied and no indent attributes will be applied.
-                xTmp->SetItemSet( aSet, true );
-            }
-            else
-            {
-                if(SFX_STYLE_FAMILY_PAGE == nFamily)
-                {
-                    static const sal_uInt16 aInval[] = {
-                        SID_IMAGE_ORIENTATION,
-                        SID_ATTR_CHAR_FONT,
-                        FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0};
-                    pView->GetViewFrame()->GetBindings().Invalidate(aInval);
-                }
-                SfxItemSet aTmpSet( *pDlg->GetOutputItemSet() );
-                if( SFX_STYLE_FAMILY_CHAR == nFamily )
-                {
-                    const SfxPoolItem *pTmpBrush;
-                    if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
-                        sal_False, &pTmpBrush ) )
-                    {
-                        SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
-                        aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
-                        aTmpSet.Put( aTmpBrush );
-                    }
-                    aTmpSet.ClearItem( RES_BACKGROUND );
-                }
-                xTmp->SetItemSet( aTmpSet );
+        ApplyStyle aApplyStyleHelper(*this, bNew, pStyle, nRet, xTmp, nFamily, pDlg, mxBasePool, bModified);
+        pDlg->SetApplyHdl(LINK(&aApplyStyleHelper, ApplyStyle, ApplyHdl));
 
-                if( SFX_STYLE_FAMILY_PAGE == nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
-                {
-                    const SfxPoolItem *pItem = NULL;
-                    if( aTmpSet.GetItemState( GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False ) , sal_True, &pItem ) == SFX_ITEM_SET )
-                        SwChartHelper::DoUpdateAllCharts( pDoc );
-                }
-            }
-            if(SFX_STYLE_FAMILY_PAGE == nFamily)
-                pView->InvalidateRulerPos();
-
-            if( bNew )
-                mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
-
-            // Destroy dialog before EndAction - with page-templates the
-            // ItemSet must be destroyed, so that the cursors get removed
-            // from Headers/Footers. Otherwise "GPF" happen!!!
-            if(RET_OK == nButton)
-                delete pDlg;
-
-            pDoc->SetModified();
-            if( !bModified )    // Bug 57028
-            {
-                pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
-            }
-
-            GetWrtShell()->EndAllAction();
+        if (RET_OK == pDlg->Execute())
+        {
+            aApplyStyleHelper.apply();
         }
         else
         {
@@ -745,11 +787,11 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn
 
             if( !bModified )
                 pDoc->ResetModified();
-            delete pDlg;
-        }
-            if(RET_APPLY_TEMPLATE != nButton)
-                break;
         }
+
+        nRet = aApplyStyleHelper.getRet();
+
+        delete pDlg;
     }
     else
     {
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 3028bba..70beaa9 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -157,6 +157,19 @@ String AbstractTabDialog_Impl::GetText() const
     return pDlg->GetText();
 }
 
+IMPL_LINK_NOARG(AbstractApplyTabDialog_Impl, ApplyHdl)
+{
+    if (pDlg->OK_Impl())
+        m_aHandler.Call(NULL);
+    return 0;
+}
+
+void AbstractApplyTabDialog_Impl::SetApplyHdl( const Link& rLink )
+{
+    m_aHandler = rLink;
+    pDlg->SetApplyHandler(LINK(this, AbstractApplyTabDialog_Impl, ApplyHdl));
+}
+
 sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetLevel() const
 {
     return pDlg->GetLevel();
@@ -1103,7 +1116,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog( int nRes
     return 0;
 }
 
-SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nResId,
+SfxAbstractApplyTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog(
                                                 Window*             pParent,
                                                 SfxStyleSheetBase&  rBase,
                                                 sal_uInt16              nRegion,
@@ -1111,19 +1124,8 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nR
                                                 SwWrtShell*         pActShell,
                                                 sal_Bool                bNew ) //add for SwTemplateDlg
 {
-    SfxTabDialog* pDlg=NULL;
-    switch ( nResId )
-    {
-        case DLG_TEMPLATE_BASE :
-            pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nPageId, pActShell, bNew );
-            break;
-        default:
-            break;
-    }
-
-    if ( pDlg )
-        return new AbstractTabDialog_Impl( pDlg );
-    return 0;
+    SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nPageId, pActShell, bNew );
+    return new AbstractApplyTabDialog_Impl( pDlg );
 }
 
 AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg( int nResId,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 451d595..1e0091c 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -46,6 +46,7 @@ class DropDownFieldDialog;
 }
 
 #define DECL_ABSTDLG_BASE(Class,DialogClass)        \
+protected:                                          \
     DialogClass*        pDlg;                       \
 public:                                             \
                     Class( DialogClass* p)          \
@@ -53,7 +54,6 @@ public:                                             \
                      {}                             \
     virtual         ~Class();                       \
     virtual short   Execute() ;
-//  virtual void    Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = 0 )
 
 #define IMPL_ABSTDLG_BASE(Class)                    \
 Class::~Class()                                     \
@@ -129,7 +129,7 @@ class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for
 // add for SwBreakDlg end
 
 //add for SwCharDlg , SwEnvDlg , SwFootNoteOptionDlg SwParaDlg  SwTableTabDlg begin
-class AbstractTabDialog_Impl : public SfxAbstractTabDialog
+class AbstractTabDialog_Impl : virtual public SfxAbstractTabDialog
 {
     DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog )
     virtual void                SetCurPageId( sal_uInt16 nId );
@@ -142,6 +142,19 @@ class AbstractTabDialog_Impl : public SfxAbstractTabDialog
 };
 //add for SwCharDlg, SwEnvDlg ,SwFootNoteOptionDlg SwParaDlg  SwTableTabDlg end
 
+class AbstractApplyTabDialog_Impl : public AbstractTabDialog_Impl, virtual public SfxAbstractApplyTabDialog
+{
+public:
+    AbstractApplyTabDialog_Impl( SfxTabDialog* p)
+        : AbstractTabDialog_Impl(p)
+    {
+    }
+    DECL_LINK(ApplyHdl, void*);
+private:
+    Link m_aHandler;
+    virtual void                SetApplyHdl( const Link& rLink );
+};
+
 //add for SwConvertTableDlg begin
 class AbstractSwConvertTableDlg_Impl :  public AbstractSwConvertTableDlg // add for SwConvertTableDlg
 {
@@ -484,7 +497,7 @@ public:
                                                 sal_Bool            bFmt     = sal_False,
                                                 sal_uInt16          nDefPage = 0,
                                                 const String*   pFmtStr  = 0); //add for SwFrmDlg
-    virtual SfxAbstractTabDialog*       CreateTemplateDialog( int nResId,
+    virtual SfxAbstractApplyTabDialog*  CreateTemplateDialog(
                                                 Window*             pParent,
                                                 SfxStyleSheetBase&  rBase,
                                                 sal_uInt16              nRegion,
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 3fca711..8003ed5 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -293,24 +293,12 @@ SwTemplateDlg::SwTemplateDlg(Window*            pParent,
 
     }
     EnableApplyButton( true );
-    SetApplyHandler( LINK(this, SwTemplateDlg, ApplyHdl ) );
 }
 
 SwTemplateDlg::~SwTemplateDlg()
 {
 }
 
-IMPL_LINK( SwTemplateDlg, ApplyHdl, void*, pVoid )
-{
-    (void)pVoid; //unused
-    if ( OK_Impl() )
-    {
-        Ok();
-        EndDialog( RET_APPLY_TEMPLATE );
-    }
-    return 0;
-}
-
 short SwTemplateDlg::Ok()
 {
     short nRet = SfxTabDialog::Ok();
diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx
index 3d91220..c2ca989 100644
--- a/sw/source/ui/inc/tmpdlg.hxx
+++ b/sw/source/ui/inc/tmpdlg.hxx
@@ -36,7 +36,6 @@ class SwTemplateDlg: public SfxStyleDialog
     sal_Bool        bNewStyle;
 
     DECL_LINK( NumOptionsHdl, PushButton* );
-    DECL_LINK( ApplyHdl, void* );
 
 public:
     SwTemplateDlg(  Window*             pParent,


More information about the Libreoffice-commits mailing list