summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-12 14:01:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-12 14:18:58 +0100
commit2fccbd4dea4d3570f1a9c5987bc1904f9211c27c (patch)
tree2709479af427f8b981e8afa917f32504291adedf
parentb79d297f4be32aa15c599ad6c1cd77580856cccc (diff)
convert annotation page break menu to .ui
Change-Id: I822029c8fe2dc8ae0a0f52091375d79c0784b7ce
-rw-r--r--sw/UIConfig_swriter.mk1
-rw-r--r--sw/inc/cmdid.h3
-rw-r--r--sw/inc/swcommands.h2
-rw-r--r--sw/source/ui/app/mn.src19
-rw-r--r--sw/source/uibase/docvw/PageBreakWin.cxx148
-rw-r--r--sw/source/uibase/inc/PageBreakWin.hxx3
-rw-r--r--sw/source/uibase/inc/popup.hrc3
-rw-r--r--sw/uiconfig/swriter/ui/pagebreakmenu.ui25
8 files changed, 102 insertions, 102 deletions
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 41fed854c5d4..81d073621edd 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -211,6 +211,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/notebookbar \
sw/uiconfig/swriter/ui/notebookbar_groups \
sw/uiconfig/swriter/ui/notebookbar_single \
+ sw/uiconfig/swriter/ui/pagebreakmenu \
sw/uiconfig/swriter/ui/pagecolumncontrol \
sw/uiconfig/swriter/ui/pagemargincontrol \
sw/uiconfig/swriter/ui/pageorientationcontrol \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 74ac12b2c4a6..9e718b820487 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -715,9 +715,6 @@
#define FN_HEADERFOOTER_DELETE (FN_HEADERFOOTER+2)
#define FN_HEADERFOOTER_BORDERBACK (FN_HEADERFOOTER+3)
-#define FN_PAGEBREAK_EDIT (FN_PAGEBREAK+1)
-#define FN_PAGEBREAK_DELETE (FN_PAGEBREAK+2)
-
// Region: Parameter
#define FN_PARAM_MOVE_COUNT (FN_PARAM+2)
#define FN_PARAM_MOVE_SELECTION (FN_PARAM+3)
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index fdcff077d38f..d1ad3e7a5ba4 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -35,8 +35,6 @@
#define CMD_FN_HEADERFOOTER_EDIT ".uno:HeaderFooterEdit"
#define CMD_FN_HEADERFOOTER_DELETE ".uno:HeaderFooterDelete"
#define CMD_FN_HEADERFOOTER_BORDERBACK ".uno:HeaderFooterBorderBackground"
-#define CMD_FN_PAGEBREAK_EDIT ".uno:PageBreakEdit"
-#define CMD_FN_PAGEBREAK_DELETE ".uno:PageBreakDelete"
#endif
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index d6dac73f716d..fe71b4d08838 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -112,23 +112,4 @@ Menu MN_HEADERFOOTER_BUTTON
};
};
-Menu MN_PAGEBREAK_BUTTON
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = FN_PAGEBREAK_EDIT ;
- HelpID = CMD_FN_PAGEBREAK_EDIT ;
- Text [ en-US ] = "Edit Page Break..." ;
- };
- MenuItem
- {
- Identifier = FN_PAGEBREAK_DELETE ;
- HelpID = CMD_FN_PAGEBREAK_DELETE ;
- Text [ en-US ] = "Delete Page Break" ;
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index dcf4b0801088..10b91718b756 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -93,7 +93,8 @@ namespace
SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame ) :
SwFrameMenuButtonBase( pEditWin, pFrame ),
- m_pPopupMenu( nullptr ),
+ m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/swriter/ui/pagebreakmenu.ui", ""),
+ m_pPopupMenu(m_aBuilder.get_menu("menu")),
m_pLine( nullptr ),
m_bIsAppearing( false ),
m_nFadeRate( 100 ),
@@ -107,10 +108,9 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame ) :
// Create the line control
m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
- // Create the popup menu
- m_pPopupMenu = VclPtr<PopupMenu>::Create( SW_RES( MN_PAGEBREAK_BUTTON ) );
+ // Set the popup menu
m_pPopupMenu->SetDeactivateHdl( LINK( this, SwPageBreakWin, HideHandler ) );
- SetPopupMenu( m_pPopupMenu );
+ SetPopupMenu(m_pPopupMenu);
m_aFadeTimer.SetTimeout( 50 );
m_aFadeTimer.SetInvokeHandler( LINK( this, SwPageBreakWin, FadeHandler ) );
@@ -127,7 +127,9 @@ void SwPageBreakWin::dispose()
m_aFadeTimer.Stop();
m_pLine.disposeAndClear();
- m_pPopupMenu.disposeAndClear();
+ m_pPopupMenu.clear();
+ m_aBuilder.disposeBuilder();
+
delete m_pMousePt;
m_pMousePt = nullptr;
@@ -214,88 +216,84 @@ void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re
pProcessor->process(aGhostedSeq);
}
-void SwPageBreakWin::Select( )
+void SwPageBreakWin::Select()
{
SwFrameControlPtr pThis = GetEditWin()->GetFrameControlsManager( ).GetControl( PageBreak, GetFrame() );
- switch( GetCurItemId( ) )
+ OString sIdent = GetCurItemIdent();
+ if (sIdent == "edit")
{
- case FN_PAGEBREAK_EDIT:
+ const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
+ while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
+ pBodyFrame = static_cast< const SwLayoutFrame* >( pBodyFrame->GetNext() );
+
+ SwEditWin* pEditWin = GetEditWin();
+
+ if ( pBodyFrame )
+ {
+ SwWrtShell& rSh = pEditWin->GetView().GetWrtShell();
+ bool bOldLock = rSh.IsViewLocked();
+ rSh.LockView( true );
+
+ if ( pBodyFrame->Lower()->IsTabFrame() )
{
- const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
- while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
- pBodyFrame = static_cast< const SwLayoutFrame* >( pBodyFrame->GetNext() );
-
- SwEditWin* pEditWin = GetEditWin();
-
- if ( pBodyFrame )
- {
- SwWrtShell& rSh = pEditWin->GetView().GetWrtShell();
- bool bOldLock = rSh.IsViewLocked();
- rSh.LockView( true );
-
- if ( pBodyFrame->Lower()->IsTabFrame() )
- {
- rSh.Push( );
- rSh.ClearMark();
-
- SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
- SwContentNode* pNd = pCnt->GetNode();
- rSh.SetSelection( *pNd );
-
- SfxStringItem aItem(pEditWin->GetView().GetPool().GetWhich(FN_FORMAT_TABLE_DLG), "textflow");
- pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
- FN_FORMAT_TABLE_DLG,
- SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
- { &aItem });
-
- rSh.Pop( false );
- }
- else
- {
- SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
- SwContentNode* pNd = pCnt->GetNode();
-
- SwPaM aPaM( *pNd );
- SwPaMItem aPaMItem( pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
- SfxStringItem aItem( pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), "textflow" );
- pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
- SID_PARA_DLG,
- SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
- { &aItem, &aPaMItem });
- }
- rSh.LockView( bOldLock );
- pEditWin->GrabFocus( );
- }
+ rSh.Push( );
+ rSh.ClearMark();
+
+ SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
+ SwContentNode* pNd = pCnt->GetNode();
+ rSh.SetSelection( *pNd );
+
+ SfxStringItem aItem(pEditWin->GetView().GetPool().GetWhich(FN_FORMAT_TABLE_DLG), "textflow");
+ pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
+ FN_FORMAT_TABLE_DLG,
+ SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
+ { &aItem });
+
+ rSh.Pop( false );
}
- break;
- case FN_PAGEBREAK_DELETE:
+ else
{
- const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
- while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
- pBodyFrame = static_cast< const SwLayoutFrame* >( pBodyFrame->GetNext() );
+ SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
+ SwContentNode* pNd = pCnt->GetNode();
+
+ SwPaM aPaM( *pNd );
+ SwPaMItem aPaMItem( pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
+ SfxStringItem aItem( pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), "textflow" );
+ pEditWin->GetView().GetViewFrame()->GetDispatcher()->ExecuteList(
+ SID_PARA_DLG,
+ SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
+ { &aItem, &aPaMItem });
+ }
+ rSh.LockView( bOldLock );
+ pEditWin->GrabFocus( );
+ }
+ }
+ else if (sIdent == "delete")
+ {
+ const SwLayoutFrame* pBodyFrame = static_cast< const SwLayoutFrame* >( GetPageFrame()->Lower() );
+ while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
+ pBodyFrame = static_cast< const SwLayoutFrame* >( pBodyFrame->GetNext() );
- if ( pBodyFrame )
- {
- SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
- SwContentNode* pNd = pCnt->GetNode();
+ if ( pBodyFrame )
+ {
+ SwContentFrame *pCnt = const_cast< SwContentFrame* >( pBodyFrame->ContainsContent() );
+ SwContentNode* pNd = pCnt->GetNode();
- pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
+ pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
- SfxItemSet aSet( GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
- RES_PAGEDESC, RES_PAGEDESC,
- RES_BREAK, RES_BREAK,
- nullptr );
- aSet.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
- aSet.Put( SwFormatPageDesc( nullptr ) );
+ SfxItemSet aSet( GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
+ RES_PAGEDESC, RES_PAGEDESC,
+ RES_BREAK, RES_BREAK,
+ nullptr );
+ aSet.Put( SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK ) );
+ aSet.Put( SwFormatPageDesc( nullptr ) );
- SwPaM aPaM( *pNd );
- pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet( aPaM, aSet );
+ SwPaM aPaM( *pNd );
+ pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet( aPaM, aSet );
- pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
- }
- }
- break;
+ pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
+ }
}
// Only fade if there is more than this temporary shared pointer:
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx
index 21e0bbc60757..995154ce6ced 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -10,7 +10,7 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_PAGEBREAKWIN_HXX
#include <FrameControl.hxx>
-
+#include <vcl/builder.hxx>
#include <vcl/menubtn.hxx>
class SwPageFrame;
@@ -22,6 +22,7 @@ class SwPageFrame;
*/
class SwPageBreakWin : public SwFrameMenuButtonBase
{
+ VclBuilder m_aBuilder;
VclPtr<PopupMenu> m_pPopupMenu;
VclPtr<vcl::Window> m_pLine;
bool m_bIsAppearing;
diff --git a/sw/source/uibase/inc/popup.hrc b/sw/source/uibase/inc/popup.hrc
index a34fb0c87618..9f12daf1a534 100644
--- a/sw/source/uibase/inc/popup.hrc
+++ b/sw/source/uibase/inc/popup.hrc
@@ -24,9 +24,8 @@
#define MN_ANNOTATION_BUTTON (RC_POPUPS_BEGIN + 0)
#define MN_HEADERFOOTER_BUTTON (RC_POPUPS_BEGIN + 1)
-#define MN_PAGEBREAK_BUTTON (RC_POPUPS_BEGIN + 2)
-#if MN_PAGEBREAK_BUTTON > RC_POPUPS_END
+#if MN_HEADERFOOTER_BUTTON > RC_POPUPS_END
#error Resource-Id Ueberlauf in #file, #line
#endif
diff --git a/sw/uiconfig/swriter/ui/pagebreakmenu.ui b/sw/uiconfig/swriter/ui/pagebreakmenu.ui
new file mode 100644
index 000000000000..b528891a221d
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/pagebreakmenu.ui
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="edit">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Edit Page Break...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="delete">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Delete Page Break</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>