diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-09-25 11:35:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:50 +0100 |
commit | 8d793b044562e1eec73ffd081e44f44c392eb4b2 (patch) | |
tree | 556228bcc13f4f76f9a4e774c0f2607e8c573ae9 /sw | |
parent | 722f63f50566137a397ddb9b327ba9a0eb468e4d (diff) |
adapt code to new table autoformat dialog
Change-Id: I7bc8c1b37fa9757c5d47902d54865d0319135517
Diffstat (limited to 'sw')
-rw-r--r-- | sw/UI_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/helpid.h | 1 | ||||
-rw-r--r-- | sw/inc/swabstdlg.hxx | 1 | ||||
-rw-r--r-- | sw/source/ui/app/app.src | 70 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 1 | ||||
-rw-r--r-- | sw/source/ui/inc/app.hrc | 17 | ||||
-rw-r--r-- | sw/source/ui/inc/table.hrc | 2 | ||||
-rw-r--r-- | sw/source/ui/inc/tautofmt.hxx | 29 | ||||
-rw-r--r-- | sw/source/ui/shells/tabsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/table/convert.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/table/instable.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/table/tautofmt.cxx | 232 | ||||
-rw-r--r-- | sw/source/ui/table/tautofmt.hrc | 14 | ||||
-rw-r--r-- | sw/source/ui/table/tautofmt.src | 190 |
16 files changed, 226 insertions, 362 deletions
diff --git a/sw/UI_swriter.mk b/sw/UI_swriter.mk index a9371ffc98d8..9a3338cdf2ae 100644 --- a/sw/UI_swriter.mk +++ b/sw/UI_swriter.mk @@ -10,6 +10,7 @@ $(eval $(call gb_UI_UI,modules/swriter)) $(eval $(call gb_UI_add_uifiles,modules/swriter,\ + sw/uiconfig/swriter/ui/autoformattable \ sw/uiconfig/swriter/ui/charurlpage \ sw/uiconfig/swriter/ui/columnwidth \ sw/uiconfig/swriter/ui/converttexttable \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index f8e4febd1a50..a679a27702ac 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -341,7 +341,6 @@ #define HID_EDIT_FORMULA "SW_HID_EDIT_FORMULA" #define HID_INSERT_FILE "SW_HID_INSERT_FILE" #define HID_FORMAT_PAGE "SW_HID_FORMAT_PAGE" -#define HID_AUTOFMT_TABLE "SW_HID_AUTOFMT_TABLE" #define HID_SWDLG_STRINPUT "SW_HID_SWDLG_STRINPUT" #define HID_RENAME_GLOSSARY "SW_HID_RENAME_GLOSSARY" #define HID_CONFIG_MENU "SW_HID_CONFIG_MENU" diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 45d4082b63d3..10398a842d6b 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -400,7 +400,6 @@ public: virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ) = 0; //add for SwSplitTblDlg virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg - int nResId, sal_Bool bSetAutoFmt = sal_True, const SwTableAutoFmt* pSelFmt = 0 ) = 0; virtual SfxAbstractDialog * CreateSwBorderDlg ( Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId ) = 0;//add for SwBorderDlg diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index dfec7f3984f8..b4f0e5db9118 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -570,6 +570,76 @@ String STR_SYMBOL Text [ en-US ] = "Symbol" ; }; +String STR_ADD_AUTOFORMAT_TITLE +{ + Text [ en-US ] = "Add AutoFormat" ; +}; + +String STR_ADD_AUTOFORMAT_LABEL +{ + Text [ en-US ] = "Name" ; +}; + +String STR_DEL_AUTOFORMAT_TITLE +{ + Text [ en-US ] = "Delete AutoFormat" ; +}; + +String STR_DEL_AUTOFORMAT_MSG +{ + Text [ en-US ] = "The following AutoFormat entry will be deleted:" ; +}; + +String STR_RENAME_AUTOFORMAT_TITLE +{ + Text [ en-US ] = "Rename AutoFormat" ; +}; + +String STR_BTN_AUTOFORMAT_CLOSE +{ + Text [ en-US ] = "~Close" ; +}; + +String STR_JAN +{ + Text [ en-US ] = "Jan" ; +}; + +String STR_FEB +{ + Text [ en-US ] = "Feb" ; +}; + +String STR_MAR +{ + Text [ en-US ] = "Mar" ; +}; + +String STR_NORTH +{ + Text [ en-US ] = "North" ; +}; + +String STR_MID +{ + Text [ en-US ] = "Mid" ; +}; + +String STR_SOUTH +{ + Text [ en-US ] = "South" ; +}; + +String STR_SUM +{ + Text [ en-US ] = "Sum" ; +}; + +String STR_INVALID_AUTOFORMAT_NAME +{ + Text [ en-US ] = "You have entered an invalid name.\nThe desired AutoFormat could not be created. \nTry again using a different name." ; +}; + ToolBox RID_MODULE_TOOLBOX { HelpID = HID_MODULE_TOOLBOX ; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 00bac12929cc..713b587378f9 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -776,7 +776,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, AutoFmtHdl, PushButton*, pButton ) SwAbstractDialogFactory* pFact = swui::GetFactory(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pView->GetWrtShellPtr(),DLG_AUTOFMT_TABLE, sal_False, pTAutoFmt); + AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pView->GetWrtShellPtr(), sal_False, pTAutoFmt); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if( RET_OK == pDlg->Execute()) pDlg->FillAutoFmtOfIndex( pTAutoFmt ); diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 831dee306461..a062c72dc857 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -973,25 +973,11 @@ AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg return 0; } -AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, - int nResId, - sal_Bool bSetAutoFmt, - const SwTableAutoFmt* pSelFmt ) +AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(Window* pParent, + SwWrtShell* pShell, sal_Bool bSetAutoFmt, const SwTableAutoFmt* pSelFmt) { - SwAutoFormatDlg* pDlg=NULL; - switch ( nResId ) - { - case DLG_AUTOFMT_TABLE : - pDlg = new SwAutoFormatDlg( pParent, pShell,bSetAutoFmt,pSelFmt); - break; - - default: - break; - } - - if ( pDlg ) - return new AbstractSwAutoFormatDlg_Impl( pDlg ); - return 0; + SwAutoFormatDlg* pDlg = new SwAutoFormatDlg(pParent, pShell, bSetAutoFmt, pSelFmt); + return new AbstractSwAutoFormatDlg_Impl(pDlg); } SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, sal_uInt16 nType,int nResId ) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 74c2de38a0c0..da5e1801b7ab 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -479,7 +479,6 @@ public: virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ); //add for SwSplitTblDlg virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg - int nResId, sal_Bool bSetAutoFmt = sal_True, const SwTableAutoFmt* pSelFmt = 0 ); virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, sal_uInt16 nType,int nResId );//add for SwBorderDlg diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc index 8c6115465363..8346d0ef3232 100644 --- a/sw/source/ui/inc/app.hrc +++ b/sw/source/ui/inc/app.hrc @@ -97,7 +97,22 @@ #define STR_STATUSBAR_WORDCOUNT_NO_SELECTION (RC_APP_BEGIN + 110) #define STR_STATUSBAR_WORDCOUNT (RC_APP_BEGIN + 111) -#define APP_ACT_END STR_STATUSBAR_WORDCOUNT +#define STR_ADD_AUTOFORMAT_TITLE (RC_APP_BEGIN + 112) +#define STR_ADD_AUTOFORMAT_LABEL (RC_APP_BEGIN + 113) +#define STR_DEL_AUTOFORMAT_TITLE (RC_APP_BEGIN + 114) +#define STR_DEL_AUTOFORMAT_MSG (RC_APP_BEGIN + 115) +#define STR_RENAME_AUTOFORMAT_TITLE (RC_APP_BEGIN + 116) +#define STR_BTN_AUTOFORMAT_CLOSE (RC_APP_BEGIN + 117) +#define STR_INVALID_AUTOFORMAT_NAME (RC_APP_BEGIN + 118) +#define STR_JAN (RC_APP_BEGIN + 119) +#define STR_FEB (RC_APP_BEGIN + 120) +#define STR_MAR (RC_APP_BEGIN + 121) +#define STR_NORTH (RC_APP_BEGIN + 122) +#define STR_MID (RC_APP_BEGIN + 123) +#define STR_SOUTH (RC_APP_BEGIN + 124) +#define STR_SUM (RC_APP_BEGIN + 125) + +#define APP_ACT_END STR_SUM #if APP_ACT_END > RC_APP_END #error Resource-Id Ueberlauf in #file, #line diff --git a/sw/source/ui/inc/table.hrc b/sw/source/ui/inc/table.hrc index 0394e3648355..390ecb399aad 100644 --- a/sw/source/ui/inc/table.hrc +++ b/sw/source/ui/inc/table.hrc @@ -25,7 +25,7 @@ #define MSG_ERR_TABLE_MERGE (RC_TABLE_BEGIN + 7) -#define DLG_AUTOFMT_TABLE (RC_TABLE_BEGIN + 9) + #define DLG_SWDLG_STRINPUT (RC_TABLE_BEGIN + 10) #define TP_TABLE_COLUMN (RC_TABLE_BEGIN + 11) #define DLG_INSERT_CHART (RC_TABLE_BEGIN + 12) diff --git a/sw/source/ui/inc/tautofmt.hxx b/sw/source/ui/inc/tautofmt.hxx index ef1ef18f61d0..8f8d29a3933e 100644 --- a/sw/source/ui/inc/tautofmt.hxx +++ b/sw/source/ui/inc/tautofmt.hxx @@ -52,21 +52,18 @@ enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE }; class SwAutoFormatDlg : public SfxModalDialog { - FixedLine aFlFormat; - ListBox aLbFormat; - FixedLine aFlFormats; - CheckBox aBtnNumFormat; - CheckBox aBtnBorder; - CheckBox aBtnFont; - CheckBox aBtnPattern; - CheckBox aBtnAlignment; - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - PushButton aBtnAdd; - PushButton aBtnRemove; - PushButton aBtnRename; - MoreButton aBtnMore; + ListBox* m_pLbFormat; + VclContainer* m_pFormatting; + CheckBox* m_pBtnNumFormat; + CheckBox* m_pBtnBorder; + CheckBox* m_pBtnFont; + CheckBox* m_pBtnPattern; + CheckBox* m_pBtnAlignment; + OKButton* m_pBtnOk; + CancelButton* m_pBtnCancel; + PushButton* m_pBtnAdd; + PushButton* m_pBtnRemove; + PushButton* m_pBtnRename; String aStrTitle; String aStrLabel; String aStrClose; @@ -74,7 +71,7 @@ class SwAutoFormatDlg : public SfxModalDialog String aStrDelMsg; String aStrRenameTitle; String aStrInvalidFmt; - AutoFmtPreview* pWndPreview; + AutoFmtPreview* m_pWndPreview; //------------------------ SwWrtShell* pShell; diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 76b4adc303a6..56c788f575c4 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -806,7 +806,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh , DLG_AUTOFMT_TABLE ); + AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->Execute(); delete pDlg; diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index 5b0c72b4f936..f76e2fb6f58f 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -199,7 +199,7 @@ IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton ) SwAbstractDialogFactory* pFact = swui::GetFactory(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, DLG_AUTOFMT_TABLE, sal_False, pTAutoFmt); + AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, sal_False, pTAutoFmt); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if( RET_OK == pDlg->Execute()) pDlg->FillAutoFmtOfIndex( pTAutoFmt ); diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 629a8cf6c1cd..fbffb7e86d5e 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -196,7 +196,7 @@ IMPL_LINK( SwInsTableDlg, AutoFmtHdl, PushButton*, pButton ) SwAbstractDialogFactory* pFact = swui::GetFactory(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, DLG_AUTOFMT_TABLE, sal_False, pTAutoFmt ); + AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, sal_False, pTAutoFmt); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if( RET_OK == pDlg->Execute()) pDlg->FillAutoFmtOfIndex( pTAutoFmt ); diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 09e346d63c85..e20f6225d019 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <vcl/edit.hxx> +#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #include <svl/zforlist.hxx> @@ -36,6 +37,7 @@ #include <svtools/scriptedtext.hxx> #include <svtools/accessibilityoptions.hxx> #include <svx/framelinkarray.hxx> +#include "app.hrc" #include "swmodule.hxx" #include "swtypes.hxx" #include "view.hxx" @@ -54,11 +56,14 @@ using namespace com::sun::star; class AutoFmtPreview : public Window { public: - AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell ); - ~AutoFmtPreview(); + AutoFmtPreview(Window* pParent); + ~AutoFmtPreview(); void NotifyChange( const SwTableAutoFmt& rNewData ); + void DetectRTL(SwWrtShell* pWrtShell); + + virtual void Resize(); protected: virtual void Paint( const Rectangle& rRect ); @@ -161,45 +166,40 @@ SwStringInputDlg::~SwStringInputDlg() SwAutoFormatDlg::SwAutoFormatDlg( Window* pParent, SwWrtShell* pWrtShell, sal_Bool bSetAutoFormat, const SwTableAutoFmt* pSelFmt ) - : SfxModalDialog( pParent, SW_RES( DLG_AUTOFMT_TABLE ) ), - // - aFlFormat ( this, SW_RES( FL_FORMAT ) ), - aLbFormat ( this, SW_RES( LB_FORMAT ) ), - aFlFormats ( this, SW_RES( FL_FORMATS ) ), - - aBtnNumFormat ( this, SW_RES( BTN_NUMFORMAT ) ), - aBtnBorder ( this, SW_RES( BTN_BORDER ) ), - aBtnFont ( this, SW_RES( BTN_FONT ) ), - aBtnPattern ( this, SW_RES( BTN_PATTERN ) ), - aBtnAlignment ( this, SW_RES( BTN_ALIGNMENT ) ), - aBtnOk ( this, SW_RES( BTN_OK ) ), - aBtnCancel ( this, SW_RES( BTN_CANCEL ) ), - aBtnHelp ( this, SW_RES( BTN_HELP ) ), - aBtnAdd ( this, SW_RES( BTN_ADD ) ), - aBtnRemove ( this, SW_RES( BTN_REMOVE ) ), - aBtnRename ( this, SW_RES( BTN_RENAME ) ), - aBtnMore ( this, SW_RES( BTN_MORE ) ), - aStrTitle ( SW_RES( STR_ADD_TITLE ) ), - aStrLabel ( SW_RES( STR_ADD_LABEL ) ), - aStrClose ( SW_RES( STR_BTN_CLOSE ) ), - aStrDelTitle ( SW_RES( STR_DEL_TITLE ) ), - aStrDelMsg ( SW_RES( STR_DEL_MSG ) ), - aStrRenameTitle ( SW_RES( STR_RENAME_TITLE ) ), - aStrInvalidFmt ( SW_RES( STR_INVALID_AFNAME )), - pWndPreview ( new AutoFmtPreview( this, SW_RES( WND_PREVIEW ), pWrtShell )), - // - pShell ( pWrtShell ), - nIndex ( 0 ), - nDfltStylePos ( 0 ), - bCoreDataChanged( sal_False ), - bSetAutoFmt ( bSetAutoFormat ) -{ + : SfxModalDialog(pParent, "AutoFormatTableDialog", "modules/swriter/ui/autoformattable.ui") + , aStrTitle(SW_RES(STR_ADD_AUTOFORMAT_TITLE)) + , aStrLabel(SW_RES(STR_ADD_AUTOFORMAT_LABEL)) + , aStrClose(SW_RES(STR_BTN_AUTOFORMAT_CLOSE)) + , aStrDelTitle(SW_RES(STR_DEL_AUTOFORMAT_TITLE)) + , aStrDelMsg(SW_RES(STR_DEL_AUTOFORMAT_MSG)) + , aStrRenameTitle(SW_RES(STR_RENAME_AUTOFORMAT_TITLE)) + , aStrInvalidFmt(SW_RES(STR_INVALID_AUTOFORMAT_NAME)) + , pShell(pWrtShell) + , nIndex(0) + , nDfltStylePos(0) + , bCoreDataChanged(sal_False) + , bSetAutoFmt(bSetAutoFormat) +{ + get(m_pLbFormat, "formatlb"); + get(m_pFormatting, "formatting"); + get(m_pBtnNumFormat, "numformatcb"); + get(m_pBtnBorder, "bordercb"); + get(m_pBtnFont, "fontcb"); + get(m_pBtnPattern, "patterncb"); + get(m_pBtnAlignment, "alignmentcb"); + get(m_pBtnOk, "ok"); + get(m_pBtnCancel, "cancel"); + get(m_pBtnAdd, "add"); + get(m_pBtnRemove, "remove"); + get(m_pBtnRename, "rename"); + get(m_pWndPreview, "preview"); + + m_pWndPreview->DetectRTL(pWrtShell); + pTableTbl = new SwTableAutoFmtTbl; pTableTbl->Load(); - Init( pSelFmt ); - //------------- > - FreeResource(); + Init(pSelFmt); } //------------------------------------------------------------------------ @@ -207,9 +207,7 @@ SwAutoFormatDlg::SwAutoFormatDlg( Window* pParent, SwWrtShell* pWrtShell, SwAutoFormatDlg::~SwAutoFormatDlg() { - delete pWndPreview; - - if( bCoreDataChanged ) + if (bCoreDataChanged) pTableTbl->Save(); delete pTableTbl; } @@ -220,33 +218,25 @@ SwAutoFormatDlg::~SwAutoFormatDlg() void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) { Link aLk( LINK( this, SwAutoFormatDlg, CheckHdl ) ); - aBtnBorder.SetClickHdl( aLk ); - aBtnFont.SetClickHdl( aLk ); - aBtnPattern.SetClickHdl( aLk ); - aBtnAlignment.SetClickHdl( aLk ); - aBtnNumFormat.SetClickHdl( aLk ); - - aBtnAdd.SetClickHdl ( LINK( this, SwAutoFormatDlg, AddHdl ) ); - aBtnRemove.SetClickHdl ( LINK( this, SwAutoFormatDlg, RemoveHdl ) ); - aBtnRename.SetClickHdl ( LINK( this, SwAutoFormatDlg, RenameHdl ) ); - aBtnOk.SetClickHdl ( LINK( this, SwAutoFormatDlg, OkHdl ) ); - aLbFormat.SetSelectHdl( LINK( this, SwAutoFormatDlg, SelFmtHdl ) ); - - aBtnMore.AddWindow( &aBtnNumFormat ); - aBtnMore.AddWindow( &aBtnBorder ); - aBtnMore.AddWindow( &aBtnFont ); - aBtnMore.AddWindow( &aBtnPattern ); - aBtnMore.AddWindow( &aBtnAlignment ); - aBtnMore.AddWindow( &aFlFormats ); - aBtnMore.AddWindow( &aBtnRename ); - - aBtnAdd.Enable( bSetAutoFmt ); + m_pBtnBorder->SetClickHdl( aLk ); + m_pBtnFont->SetClickHdl( aLk ); + m_pBtnPattern->SetClickHdl( aLk ); + m_pBtnAlignment->SetClickHdl( aLk ); + m_pBtnNumFormat->SetClickHdl( aLk ); + + m_pBtnAdd->SetClickHdl ( LINK( this, SwAutoFormatDlg, AddHdl ) ); + m_pBtnRemove->SetClickHdl ( LINK( this, SwAutoFormatDlg, RemoveHdl ) ); + m_pBtnRename->SetClickHdl ( LINK( this, SwAutoFormatDlg, RenameHdl ) ); + m_pBtnOk->SetClickHdl ( LINK( this, SwAutoFormatDlg, OkHdl ) ); + m_pLbFormat->SetSelectHdl( LINK( this, SwAutoFormatDlg, SelFmtHdl ) ); + + m_pBtnAdd->Enable( bSetAutoFmt ); nIndex = 0; if( !bSetAutoFmt ) { // dann muss die Liste um den Eintrag <Keins> erweitert werden. - aLbFormat.InsertEntry( ViewShell::GetShellRes()->aStrNone ); + m_pLbFormat->InsertEntry( ViewShell::GetShellRes()->aStrNone ); nDfltStylePos = 1; nIndex = 255; } @@ -255,12 +245,12 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) i < nCount; i++) { SwTableAutoFmt const& rFmt = (*pTableTbl)[ i ]; - aLbFormat.InsertEntry(rFmt.GetName()); + m_pLbFormat->InsertEntry(rFmt.GetName()); if (pSelFmt && rFmt.GetName() == pSelFmt->GetName()) nIndex = i; } - aLbFormat.SelectEntryPos( 255 != nIndex ? (nDfltStylePos + nIndex) : 0 ); + m_pLbFormat->SelectEntryPos( 255 != nIndex ? (nDfltStylePos + nIndex) : 0 ); SelFmtHdl( 0 ); } @@ -269,20 +259,20 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFmt& rFmt, sal_Bool bEnable ) { - aBtnNumFormat.Enable( bEnable ); - aBtnNumFormat.Check( rFmt.IsValueFormat() ); + m_pBtnNumFormat->Enable( bEnable ); + m_pBtnNumFormat->Check( rFmt.IsValueFormat() ); - aBtnBorder.Enable( bEnable ); - aBtnBorder.Check( rFmt.IsFrame() ); + m_pBtnBorder->Enable( bEnable ); + m_pBtnBorder->Check( rFmt.IsFrame() ); - aBtnFont.Enable( bEnable ); - aBtnFont.Check( rFmt.IsFont() ); + m_pBtnFont->Enable( bEnable ); + m_pBtnFont->Check( rFmt.IsFont() ); - aBtnPattern.Enable( bEnable ); - aBtnPattern.Check( rFmt.IsBackground() ); + m_pBtnPattern->Enable( bEnable ); + m_pBtnPattern->Check( rFmt.IsBackground() ); - aBtnAlignment.Enable( bEnable ); - aBtnAlignment.Check( rFmt.IsJustify() ); + m_pBtnAlignment->Enable( bEnable ); + m_pBtnAlignment->Check( rFmt.IsJustify() ); } void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const @@ -309,15 +299,15 @@ IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn ) SwTableAutoFmt* pData = &(*pTableTbl)[nIndex]; sal_Bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = sal_True; - if( pBtn == &aBtnNumFormat ) + if( pBtn == m_pBtnNumFormat ) pData->SetValueFormat( bCheck ); - else if ( pBtn == &aBtnBorder ) + else if ( pBtn == m_pBtnBorder ) pData->SetFrame( bCheck ); - else if ( pBtn == &aBtnFont ) + else if ( pBtn == m_pBtnFont ) pData->SetFont( bCheck ); - else if ( pBtn == &aBtnPattern ) + else if ( pBtn == m_pBtnPattern ) pData->SetBackground( bCheck ); - else if ( pBtn == &aBtnAlignment ) + else if ( pBtn == m_pBtnAlignment ) pData->SetJustify( bCheck ); else bDataChgd = sal_False; @@ -326,11 +316,11 @@ IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn ) { if( !bCoreDataChanged ) { - aBtnCancel.SetText( aStrClose ); + m_pBtnCancel->SetText( aStrClose ); bCoreDataChanged = sal_True; } - pWndPreview->NotifyChange( *pData ); + m_pWndPreview->NotifyChange( *pData ); } return 0; } @@ -373,13 +363,13 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl) break; pTableTbl->InsertAutoFmt(n, pNewData); - aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n ); - aLbFormat.SelectEntryPos( nDfltStylePos + n ); + m_pLbFormat->InsertEntry( aFormatName, nDfltStylePos + n ); + m_pLbFormat->SelectEntryPos( nDfltStylePos + n ); bFmtInserted = sal_True; - aBtnAdd.Enable( sal_False ); + m_pBtnAdd->Enable( sal_False ); if ( !bCoreDataChanged ) { - aBtnCancel.SetText( aStrClose ); + m_pBtnCancel->SetText( aStrClose ); bCoreDataChanged = sal_True; } @@ -409,7 +399,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl) { String aMessage = aStrDelMsg ; aMessage.AppendAscii("\n\n"); - aMessage += aLbFormat.GetSelectEntry() ; + aMessage += m_pLbFormat->GetSelectEntry() ; aMessage += '\n'; MessBox* pBox = new MessBox( this, WinBits( WB_OK_CANCEL ), @@ -417,21 +407,21 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl) if ( pBox->Execute() == RET_OK ) { - aLbFormat.RemoveEntry( nDfltStylePos + nIndex ); - aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 ); + m_pLbFormat->RemoveEntry( nDfltStylePos + nIndex ); + m_pLbFormat->SelectEntryPos( nDfltStylePos + nIndex-1 ); pTableTbl->EraseAutoFmt(nIndex); nIndex--; if( !nIndex ) { - aBtnRemove.Enable(sal_False); - aBtnRename.Enable(sal_False); + m_pBtnRemove->Enable(sal_False); + m_pBtnRename->Enable(sal_False); } if( !bCoreDataChanged ) { - aBtnCancel.SetText( aStrClose ); + m_pBtnCancel->SetText( aStrClose ); bCoreDataChanged = sal_True; } } @@ -448,7 +438,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) while( !bOk ) { SwStringInputDlg* pDlg = new SwStringInputDlg( this, - aStrRenameTitle, aLbFormat.GetSelectEntry(), + aStrRenameTitle, m_pLbFormat->GetSelectEntry(), aEmptyStr ); if( pDlg->Execute() == RET_OK ) { @@ -466,7 +456,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) if( n >= pTableTbl->size() ) { // no format with this name exists, so rename it - aLbFormat.RemoveEntry( nDfltStylePos + nIndex ); + m_pLbFormat->RemoveEntry( nDfltStylePos + nIndex ); SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ]; p->SetName( aFormatName ); @@ -480,12 +470,12 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) } pTableTbl->MoveAutoFmt(n, nIndex); - aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n ); - aLbFormat.SelectEntryPos( nDfltStylePos + n ); + m_pLbFormat->InsertEntry( aFormatName, nDfltStylePos + n ); + m_pLbFormat->SelectEntryPos( nDfltStylePos + n ); if ( !bCoreDataChanged ) { - aBtnCancel.SetText( aStrClose ); + m_pBtnCancel->SetText( aStrClose ); bCoreDataChanged = sal_True; } @@ -515,11 +505,11 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl) { sal_Bool bBtnEnable = sal_False; - sal_uInt8 nSelPos = (sal_uInt8) aLbFormat.GetSelectEntryPos(), nOldIdx = nIndex; + sal_uInt8 nSelPos = (sal_uInt8) m_pLbFormat->GetSelectEntryPos(), nOldIdx = nIndex; if( nSelPos >= nDfltStylePos ) { nIndex = nSelPos - nDfltStylePos; - pWndPreview->NotifyChange( (*pTableTbl)[nIndex] ); + m_pWndPreview->NotifyChange( (*pTableTbl)[nIndex] ); bBtnEnable = 0 != nIndex; UpdateChecks( (*pTableTbl)[nIndex], sal_True ); } @@ -536,12 +526,12 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl) aTmp.SetWidthHeight( sal_False ); if( nOldIdx != nIndex ) - pWndPreview->NotifyChange( aTmp ); + m_pWndPreview->NotifyChange( aTmp ); UpdateChecks( aTmp, sal_False ); } - aBtnRemove.Enable( bBtnEnable ); - aBtnRename.Enable( bBtnEnable ); + m_pBtnRemove->Enable( bBtnEnable ); + m_pBtnRename->Enable( bBtnEnable ); return 0; } @@ -561,19 +551,13 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl) //------------------------------------------------------------------------ -AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell ) : - Window ( pParent, rRes ), - +AutoFmtPreview::AutoFmtPreview(Window* pParent) : + Window ( pParent ), aCurData ( aEmptyStr ), aVD ( *this ), aScriptedText ( aVD ), bFitWidth ( sal_False ), mbRTL ( false ), - aPrvSize ( GetSizePixel().Width() - 6, GetSizePixel().Height() - 30 ), - nLabelColWidth ( (aPrvSize.Width() - 4) / 4 - 12 ), - nDataColWidth1 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3 ), - nDataColWidth2 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4 ), - nRowHeight ( (aPrvSize.Height() - 4) / 5 ), aStrJan ( SW_RES( STR_JAN ) ), aStrFeb ( SW_RES( STR_FEB ) ), aStrMar ( SW_RES( STR_MAR ) ), @@ -583,11 +567,6 @@ AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* aStrSum ( SW_RES( STR_SUM ) ), m_xMSF ( comphelper::getProcessServiceFactory() ) { - if (!pWrtShell->IsCrsrInTbl()) // We haven't created the table yet - mbRTL = Application::GetSettings().GetLayoutRTL(); - else - mbRTL = pWrtShell->IsTableRightToLeft(); - OSL_ENSURE( m_xMSF.is(), "AutoFmtPreview: no MultiServiceFactory"); if ( m_xMSF.is() ) { @@ -601,6 +580,29 @@ AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* Init(); } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeAutoFmtPreview(Window *pParent, VclBuilder::stringmap &) +{ + return new AutoFmtPreview(pParent); +} + +void AutoFmtPreview::Resize() +{ + aPrvSize = Size(GetSizePixel().Width() - 6, GetSizePixel().Height() - 30); + nLabelColWidth = (aPrvSize.Width() - 4) / 4 - 12; + nDataColWidth1 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3; + nDataColWidth2 = (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4; + nRowHeight = (aPrvSize.Height() - 4) / 5; + NotifyChange(aCurData); +} + +void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell) +{ + if (!pWrtShell->IsCrsrInTbl()) // We haven't created the table yet + mbRTL = Application::GetSettings().GetLayoutRTL(); + else + mbRTL = pWrtShell->IsTableRightToLeft(); +} + //------------------------------------------------------------------------ AutoFmtPreview::~AutoFmtPreview() diff --git a/sw/source/ui/table/tautofmt.hrc b/sw/source/ui/table/tautofmt.hrc index 082283bea512..0ac480d6153c 100644 --- a/sw/source/ui/table/tautofmt.hrc +++ b/sw/source/ui/table/tautofmt.hrc @@ -41,20 +41,6 @@ #define BTN_FONT 23 #define BTN_PATTERN 24 #define BTN_ALIGNMENT 25 -#define STR_ADD_TITLE 100 -#define STR_ADD_LABEL 101 -#define STR_DEL_TITLE 102 -#define STR_DEL_MSG 103 -#define STR_INVALID_AFNAME 104 -#define STR_RENAME_TITLE 105 - // Autoformat-Preview: -#define STR_JAN 121 -#define STR_FEB 122 -#define STR_MAR 123 -#define STR_NORTH 124 -#define STR_MID 125 -#define STR_SOUTH 126 -#define STR_SUM 127 // Gruppierung setzen/aufheben: #define BTN_GROUP_COLS 1 diff --git a/sw/source/ui/table/tautofmt.src b/sw/source/ui/table/tautofmt.src index ef6041f3b621..620f6e5e7a29 100644 --- a/sw/source/ui/table/tautofmt.src +++ b/sw/source/ui/table/tautofmt.src @@ -27,196 +27,6 @@ #include "tautofmt.hrc" #include "helpid.h" -ModalDialog DLG_AUTOFMT_TABLE -{ - OutputSize = TRUE ; - SVLook = TRUE ; - HelpID = HID_AUTOFMT_TABLE ; - Size = MAP_APPFONT ( 312 , 120 ) ; - Text [ en-US ] = "AutoFormat" ; - Moveable = TRUE ; - FixedLine FL_FORMAT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 243 , 8 ) ; - Text [ en-US ] = "Format" ; - }; - ListBox LB_FORMAT - { - HelpID = "sw:ListBox:DLG_AUTOFMT_TABLE:LB_FORMAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 65 , 100 ) ; - TabStop = TRUE ; - }; - Window WND_PREVIEW - { - Pos = MAP_APPFONT ( 83 , 14 ) ; - Size = MAP_APPFONT ( 161 , 100 ) ; - Border = TRUE; - }; - CheckBox BTN_NUMFORMAT - { - HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_NUMFORMAT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 131 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Number format" ; - TabStop = TRUE ; - }; - CheckBox BTN_BORDER - { - HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_BORDER"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 147 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Borders" ; - TabStop = TRUE ; - }; - CheckBox BTN_FONT - { - HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_FONT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 85 , 131 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "F~ont" ; - TabStop = TRUE ; - }; - CheckBox BTN_PATTERN - { - HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_PATTERN"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 85 , 147 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Pattern" ; - TabStop = TRUE ; - }; - CheckBox BTN_ALIGNMENT - { - HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_ALIGNMENT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 150 , 131 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "Alignmen~t" ; - TabStop = TRUE ; - }; - FixedLine FL_FORMATS - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 120 ) ; - Size = MAP_APPFONT ( 243 , 8 ) ; - Text [ en-US ] = "Formatting" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 255 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 255 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - MoreButton BTN_MORE - { - HelpID = "sw:MoreButton:DLG_AUTOFMT_TABLE:BTN_MORE"; - Pos = MAP_APPFONT ( 255 , 101 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~More" ; - TabStop = TRUE ; - MapUnit = MAP_APPFONT ; - Delta = 48 ; - }; - PushButton BTN_ADD - { - HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_ADD"; - Pos = MAP_APPFONT ( 255 , 64 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add" ; - TabStop = TRUE ; - }; - PushButton BTN_REMOVE - { - HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_REMOVE"; - Pos = MAP_APPFONT ( 255 , 81 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - }; - PushButton BTN_RENAME - { - HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_RENAME"; - Pos = MAP_APPFONT ( 255 , 123 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Rename" ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 255 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - String STR_ADD_TITLE - { - Text [ en-US ] = "Add AutoFormat" ; - }; - String STR_ADD_LABEL - { - Text [ en-US ] = "Name" ; - }; - String STR_DEL_TITLE - { - Text [ en-US ] = "Delete AutoFormat" ; - }; - String STR_DEL_MSG - { - Text [ en-US ] = "The following AutoFormat entry will be deleted:" ; - }; - String STR_RENAME_TITLE - { - Text [ en-US ] = "Rename AutoFormat" ; - }; - String STR_BTN_CLOSE - { - Text [ en-US ] = "~Close" ; - }; - String STR_JAN - { - Text [ en-US ] = "Jan" ; - }; - String STR_FEB - { - Text [ en-US ] = "Feb" ; - }; - String STR_MAR - { - Text [ en-US ] = "Mar" ; - }; - String STR_NORTH - { - Text [ en-US ] = "North" ; - }; - String STR_MID - { - Text [ en-US ] = "Mid" ; - }; - String STR_SOUTH - { - Text [ en-US ] = "South" ; - }; - String STR_SUM - { - Text [ en-US ] = "Sum" ; - }; - String STR_INVALID_AFNAME - { - Text [ en-US ] = "You have entered an invalid name.\nThe desired AutoFormat could not be created. \nTry again using a different name." ; - }; -}; ModalDialog DLG_SWDLG_STRINPUT { OutputSize = TRUE ; |