diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-10-04 15:35:41 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-10-05 16:52:02 +0200 |
commit | 9767483eea7800aadd18b4489069ad633ce7a79c (patch) | |
tree | 9a3fd3194b45db4edf6a35f0fb9e21acd59afc91 | |
parent | 47312cae2a1c5168124e44db409dd6205a05cf90 (diff) |
Page Break: basic implementation of the popup menu actions
Open the paragraph properties dialog on Text Flow tab when clicking on
the Edit item. Remove the page break (and add it to the undo stack) when
clicking on the Delete item.
-rw-r--r-- | sw/inc/swundo.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/undo.hrc | 3 | ||||
-rw-r--r-- | sw/source/core/undo/undo.src | 4 | ||||
-rw-r--r-- | sw/source/ui/docvw/PageBreakWin.cxx | 41 |
4 files changed, 48 insertions, 3 deletions
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx index 4a91cff7835e..9e0715404d3a 100644 --- a/sw/inc/swundo.hxx +++ b/sw/inc/swundo.hxx @@ -177,7 +177,8 @@ enum SwUndoId UNDO_UI_INSERT_URLBTN, UNDO_UI_INSERT_URLTXT, UNDO_UI_DELETE_INVISIBLECNTNT, - UNDO_UI_REPLACE_STYLE + UNDO_UI_REPLACE_STYLE, + UNDO_UI_DELETE_PAGE_BREAK }; diff --git a/sw/source/core/undo/undo.hrc b/sw/source/core/undo/undo.hrc index 8edccd344adf..eee3e3ce1236 100644 --- a/sw/source/core/undo/undo.hrc +++ b/sw/source/core/undo/undo.hrc @@ -172,7 +172,8 @@ #define STR_INSERT_URLTXT (UI_UNDO_BEGIN + 11) #define STR_DELETE_INVISIBLECNTNT (UI_UNDO_BEGIN + 12) #define STR_REPLACE_STYLE (UI_UNDO_BEGIN + 13) -#define UI_UNDO_END STR_REPLACE_STYLE +#define STR_DELETE_PAGE_BREAK (UI_UNDO_BEGIN + 14) +#define UI_UNDO_END STR_DELETE_PAGE_BREAK #define UNDO_MORE_STRINGS_BEGIN (UI_UNDO_END + 1) #define STR_OCCURRENCES_OF (UNDO_MORE_STRINGS_BEGIN) diff --git a/sw/source/core/undo/undo.src b/sw/source/core/undo/undo.src index fefa5ef65cdd..d1222feb01e7 100644 --- a/sw/source/core/undo/undo.src +++ b/sw/source/core/undo/undo.src @@ -189,6 +189,10 @@ String STR_REPLACE_STYLE { Text [ en-US ] = "Replace style: $1 $2 $3" ; }; +String STR_DELETE_PAGE_BREAK +{ + Text [ en-US ] = "Delete page break" ; +}; String STR_OUTLINE_LR { Text [ en-US ] = "Promote/demote outline" ; diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx index b9ca0a3a9cc7..2b70887ad087 100644 --- a/sw/source/ui/docvw/PageBreakWin.cxx +++ b/sw/source/ui/docvw/PageBreakWin.cxx @@ -25,13 +25,19 @@ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable * instead of those above. */ +#include <globals.hrc> #include <popup.hrc> #include <utlui.hrc> +#include <cmdid.h> +#include <cntfrm.hxx> #include <DashedLine.hxx> +#include <doc.hxx> #include <edtwin.hxx> +#include <IDocumentUndoRedo.hxx> #include <PageBreakWin.hxx> #include <pagefrm.hxx> +#include <view.hxx> #include <viewopt.hxx> #include <basegfx/color/bcolortools.hxx> @@ -40,6 +46,8 @@ #include <basegfx/range/b2drectangle.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <editeng/brkitem.hxx> +#include <sfx2/dispatch.hxx> #include <svx/sdr/contact/objectcontacttools.hxx> #include <vcl/decoview.hxx> #include <vcl/svapp.hxx> @@ -232,7 +240,38 @@ void SwPageBreakWin::Paint( const Rectangle& ) void SwPageBreakWin::Select( ) { - // TODO Menu item selected... + switch( GetCurItemId( ) ) + { + case FN_PAGEBREAK_EDIT: + { + // TODO Handle the break on a table case + SfxUInt16Item aItem( GetEditWin()->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), TP_PARA_EXT ); + GetEditWin()->GetView().GetViewFrame()->GetDispatcher()->Execute( + SID_PARA_DLG, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aItem, NULL ); + } + break; + case FN_PAGEBREAK_DELETE: + { + const SwLayoutFrm* pBodyFrm = static_cast< const SwLayoutFrm* >( GetPageFrame()->Lower() ); + while ( pBodyFrm && !pBodyFrm->IsBodyFrm() ) + pBodyFrm = static_cast< const SwLayoutFrm* >( pBodyFrm->GetNext() ); + + if ( pBodyFrm ) + { + // TODO Handle the break before a table case + SwCntntFrm *pCnt = const_cast< SwCntntFrm* >( pBodyFrm->ContainsCntnt() ); + sal_uInt16 nWhich = pCnt->GetAttrSet()->GetPool()->GetWhich( SID_ATTR_PARA_PAGEBREAK ); + SwCntntNode* pNd = pCnt->GetNode(); + + pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( UNDO_UI_DELETE_PAGE_BREAK, NULL ); + SvxFmtBreakItem aNoBreakItem( SVX_BREAK_NONE, nWhich ); + SwPaM aPaM( *pNd ); + pNd->GetDoc()->InsertPoolItem( aPaM, aNoBreakItem, nsSetAttrMode::SETATTR_DEFAULT ); + pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( UNDO_UI_DELETE_PAGE_BREAK, NULL ); + } + } + break; + } } void SwPageBreakWin::UpdatePosition( ) |