summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-23 21:02:12 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-23 22:24:36 +0200
commit5277f81090673387250761128821d5244523ce2e (patch)
tree10bedc2b4b207a230c06fdfb5680f4f777680c45
parentc7ac093eb5d8e60e565d00c7f1b62f52f6b0402e (diff)
Page Break: Changed the page break into a control
Page break changes (no impact on column breaks): + Create a MenuButton control for the page break + Moved the line to a SwDashedLine
-rw-r--r--default_images/sw/res/page_break.pngbin0 -> 1084 bytes
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/cmdid.h4
-rw-r--r--sw/inc/swcommands.h2
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx53
-rw-r--r--sw/source/ui/app/mn.src19
-rw-r--r--sw/source/ui/docvw/DashedLine.cxx9
-rw-r--r--sw/source/ui/docvw/FrameControlsManager.cxx39
-rw-r--r--sw/source/ui/docvw/HeaderFooterWin.cxx3
-rw-r--r--sw/source/ui/docvw/PageBreakWin.cxx277
-rw-r--r--sw/source/ui/inc/FrameControlsManager.hxx1
-rw-r--r--sw/source/ui/inc/HeaderFooterWin.hxx1
-rw-r--r--sw/source/ui/inc/PageBreakWin.hxx65
-rw-r--r--sw/source/ui/inc/popup.hrc3
-rw-r--r--sw/source/ui/inc/utlui.hrc1
-rw-r--r--sw/source/ui/utlui/utlui.src9
16 files changed, 431 insertions, 56 deletions
diff --git a/default_images/sw/res/page_break.png b/default_images/sw/res/page_break.png
new file mode 100644
index 000000000000..c9b7c16742ca
--- /dev/null
+++ b/default_images/sw/res/page_break.png
Binary files differ
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index a486d5c4d2ff..1a9a8ae22c6b 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -586,6 +586,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/docvw/AnnotationWin \
sw/source/ui/docvw/DashedLine \
sw/source/ui/docvw/FrameControlsManager \
+ sw/source/ui/docvw/PageBreakWin \
sw/source/ui/docvw/PostItMgr \
sw/source/ui/docvw/ShadowOverlayObject \
sw/source/ui/docvw/SidebarTxtControl \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 087a3c2165da..97f6e10e173c 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -68,6 +68,7 @@ included in c-context files, so c++ style stuff will cause problems.
#define FN_PARAM2 (SID_SW_START + 2400)
#define FN_NOTES (SID_SW_START + 2500)
#define FN_HEADERFOOTER (SID_SW_START + 2600)
+#define FN_PAGEBREAK (SID_SW_START + 2610)
/* More accurately, this range should be from FN_EXTRA2 to FN_PARAM2-1, but
* FN_NUMBER_NEWSTART comes from FN_FORMAT2, and FN_PARAM_LINK_DISPLAY_NAME
@@ -1019,6 +1020,9 @@ included in c-context files, so c++ style stuff will cause problems.
#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
--------------------------------------------------------------------*/
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index 9e8343e62865..20f19fc8cab9 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -436,5 +436,7 @@
#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/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 9301167805e2..22f3d6c8caa2 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -90,6 +90,7 @@
#include <bodyfrm.hxx>
#include <hffrm.hxx>
#include <colfrm.hxx>
+#include <PageBreakWin.hxx>
// <--
// --> OD #i76669#
#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
@@ -3337,51 +3338,13 @@ void SwPageFrm::PaintBreak( ) const
const SwCntntFrm *pCnt = static_cast< const SwLayoutFrm* >( pBodyFrm )->ContainsCntnt();
if ( pCnt && pCnt->IsPageBreak( sal_True ) )
{
- const SwPageFrm* pPageFrm = FindPageFrm();
- double nYLineOffset = double( pPageFrm->GetBoundRect().Top() + pPageFrm->Frm().Top() ) / 2.0;
- SwRect aRect = pPageFrm->GetBoundRect();
-
- basegfx::BColor aColor = SwViewOption::GetPageBreakColor().getBColor();
-
- // Draw the line
- drawinglayer::primitive2d::Primitive2DSequence aSeq =
- lcl_CreateDashedIndicatorPrimitive(
- basegfx::B2DPoint( double( aRect.Left() ), nYLineOffset ),
- basegfx::B2DPoint( double( aRect.Right() ), nYLineOffset ),
- aColor );
-
- aSeq.realloc( aSeq.getLength() + 1 );
-
- // Add the text above
- rtl::OUString aBreakText = ResId::toString( SW_RES( STR_PAGE_BREAK ) );
-
- basegfx::B2DVector aFontSize;
- OutputDevice* pOut = pGlobalShell->GetOut();
- Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont();
- aFont.SetHeight( 8 * 20 );
- pOut->SetFont( aFont );
- drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(
- aFontSize, aFont, false, false );
-
- Rectangle aTextRect;
- pOut->GetTextBoundRect( aTextRect, String( aBreakText ) );
- long nTextOff = ( aRect.Width() - aTextRect.GetWidth() ) / 2;
-
- basegfx::B2DHomMatrix aTextMatrix( basegfx::tools::createScaleTranslateB2DHomMatrix(
- aFontSize.getX(), aFontSize.getY(),
- aRect.Left() + nTextOff, nYLineOffset ) );
-
- drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
- new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
- aTextMatrix,
- aBreakText, 0, aBreakText.getLength(),
- std::vector< double >(),
- aFontAttr,
- lang::Locale(),
- aColor );
- aSeq[ aSeq.getLength() - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pText );
-
- ProcessPrimitives( aSeq );
+ SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pGlobalShell );
+ if ( pWrtSh )
+ {
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
+ rMngr.SetPageBreakControl( this );
+ }
}
}
SwLayoutFrm::PaintBreak( );
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 3a5c21c50d6c..9a1b842cb829 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -1459,6 +1459,25 @@ 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" ;
+ };
+ };
+};
+
Menu MN_TEXT_POPUPMENU
BASE_TEXT_POPUPMENU_BEGIN
BASE_TEXT_POPUPMENU_NOWEB
diff --git a/sw/source/ui/docvw/DashedLine.cxx b/sw/source/ui/docvw/DashedLine.cxx
index a4a09daf1715..04707336bec3 100644
--- a/sw/source/ui/docvw/DashedLine.cxx
+++ b/sw/source/ui/docvw/DashedLine.cxx
@@ -79,11 +79,10 @@ void SwDashedLine::Paint( const Rectangle& )
{
// Get a color for the contrast
basegfx::BColor aHslLine = basegfx::tools::rgb2hsl( aColor );
- double nLuminance = aHslLine.getZ() * 2.5;
- if ( nLuminance == 0 )
- nLuminance = 0.5;
- else if ( nLuminance >= 1.0 )
- nLuminance = aHslLine.getZ() * 0.4;
+ double nLuminance = aHslLine.getZ();
+ nLuminance += ( 1.0 - nLuminance ) * 0.75;
+ if ( aHslLine.getZ() > 0.7 )
+ nLuminance = aHslLine.getZ() * 0.7;
aHslLine.setZ( nLuminance );
const basegfx::BColor aOtherColor = basegfx::tools::hsl2rgb( aHslLine );
diff --git a/sw/source/ui/docvw/FrameControlsManager.cxx b/sw/source/ui/docvw/FrameControlsManager.cxx
index 69b9c98f6de9..4a0763681c95 100644
--- a/sw/source/ui/docvw/FrameControlsManager.cxx
+++ b/sw/source/ui/docvw/FrameControlsManager.cxx
@@ -29,6 +29,7 @@
#include <edtwin.hxx>
#include <FrameControlsManager.hxx>
#include <HeaderFooterWin.hxx>
+#include <PageBreakWin.hxx>
#include <pagefrm.hxx>
#include <viewopt.hxx>
#include <view.hxx>
@@ -137,10 +138,11 @@ void SwFrameControlsManager::SetHeaderFooterControl( const SwPageFrm* pPageFrm,
if ( !pControl.get() )
{
- pControl = SwFrameControlPtr( new SwHeaderFooterWin( m_pEditWin, pPageFrm, bHeader ) );
+ SwFrameControlPtr pNewControl( new SwHeaderFooterWin( m_pEditWin, pPageFrm, bHeader ) );
const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions();
- pControl->SetReadonly( pViewOpt->IsReadonly() );
- AddControl( HeaderFooter, pControl );
+ pNewControl->SetReadonly( pViewOpt->IsReadonly() );
+ AddControl( HeaderFooter, pNewControl );
+ pControl.swap( pNewControl );
}
Rectangle aPageRect = m_pEditWin->LogicToPixel( pPageFrm->Frm().SVRect() );
@@ -152,4 +154,35 @@ void SwFrameControlsManager::SetHeaderFooterControl( const SwPageFrm* pPageFrm,
pControl->ShowAll( true );
}
+void SwFrameControlsManager::SetPageBreakControl( const SwPageFrm* pPageFrm )
+{
+ // Check if we already have the control
+ SwFrameControlPtr pControl;
+
+ vector< SwFrameControlPtr > aControls = m_aControls[PageBreak];
+
+ vector< SwFrameControlPtr >::iterator pIt = aControls.begin();
+ while ( pIt != aControls.end() && !pControl.get() )
+ {
+ SwPageBreakWin* pToTest = dynamic_cast< SwPageBreakWin* >( pIt->get() );
+ if ( pToTest->GetPageFrame( ) == pPageFrm )
+ pControl = *pIt;
+ pIt++;
+ }
+
+ if ( !pControl.get() )
+ {
+ SwFrameControlPtr pNewControl( new SwPageBreakWin( m_pEditWin, pPageFrm ) );
+ const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions();
+ pNewControl->SetReadonly( pViewOpt->IsReadonly() );
+ AddControl( PageBreak, pNewControl );
+ pControl.swap( pNewControl );
+ }
+
+ SwPageBreakWin* pWin = dynamic_cast< SwPageBreakWin* >( pControl.get() );
+ pWin->UpdatePosition();
+ if ( !pWin->IsVisible() )
+ pControl->ShowAll( true );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx
index f3bb00ac3f90..770f1cdfeecd 100644
--- a/sw/source/ui/docvw/HeaderFooterWin.cxx
+++ b/sw/source/ui/docvw/HeaderFooterWin.cxx
@@ -38,6 +38,7 @@
#include <edtwin.hxx>
#include <fmthdft.hxx>
#include <HeaderFooterWin.hxx>
+#include <pagedesc.hxx>
#include <pagefrm.hxx>
#include <SwRewriter.hxx>
#include <view.hxx>
@@ -138,7 +139,7 @@ namespace
SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm, bool bHeader ) :
- MenuButton( pEditWin, WB_DIALOGCONTROL ),
+ MenuButton( pEditWin, WB_DIALOGCONTROL ),
SwFrameControl( pEditWin, pPageFrm ),
m_sLabel( ),
m_bIsHeader( bHeader ),
diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx
new file mode 100644
index 000000000000..b9ca0a3a9cc7
--- /dev/null
+++ b/sw/source/ui/docvw/PageBreakWin.cxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <popup.hrc>
+#include <utlui.hrc>
+
+#include <DashedLine.hxx>
+#include <edtwin.hxx>
+#include <PageBreakWin.hxx>
+#include <pagefrm.hxx>
+#include <viewopt.hxx>
+
+#include <basegfx/color/bcolortools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/svapp.hxx>
+
+#define BUTTON_SIZE 30
+#define ARROW_WIDTH 20
+
+using namespace basegfx;
+using namespace basegfx::tools;
+using namespace drawinglayer::primitive2d;
+
+namespace
+{
+ B2DPolygon lcl_CreatePolygon( B2DRectangle aBounds )
+ {
+ B2DPolygon aRetval;
+ const double nRadius = 4;
+ const double nKappa((M_SQRT2 - 1.0) * 4.0 / 3.0);
+
+ // Create the top left corner
+ {
+ B2DPoint aTLCorner = aBounds.getMinimum();
+ B2DPoint aStart( 0.0, nRadius );
+ B2DPoint aEnd( nRadius, 0.0 );
+ aRetval.append( aStart );
+ aRetval.appendBezierSegment(
+ interpolate( aStart, aTLCorner, nKappa ),
+ interpolate( aEnd, aTLCorner, nKappa ),
+ aEnd );
+ }
+
+ // Create the top right angle
+ {
+ B2DPoint aTMCorner( aBounds.getWidth() - ARROW_WIDTH, 0.0 );
+ B2DPoint aStart = aTMCorner + B2DVector( - nRadius, 0.0 );
+ B2DVector aEndVect( double( ARROW_WIDTH ), aBounds.getHeight() / 2.0 );
+ aEndVect.setLength( nRadius );
+ B2DPoint aEnd = aTMCorner + aEndVect;
+ aRetval.append( aStart );
+ aRetval.appendBezierSegment(
+ interpolate( aStart, aTMCorner, nKappa ),
+ interpolate( aEnd, aTMCorner, nKappa ),
+ aEnd );
+ }
+
+ // Create the right corner
+ {
+ B2DPoint aMRCorner( aBounds.getWidth(), aBounds.getHeight() / 2.0 );
+ B2DVector aStartVect( double( - ARROW_WIDTH ), - aBounds.getHeight() / 2.0 );
+ aStartVect.setLength( nRadius );
+ B2DPoint aStart = aMRCorner + aStartVect;
+ B2DVector aEndVect( double( - ARROW_WIDTH ), aBounds.getHeight() / 2.0 );
+ aEndVect.setLength( nRadius );
+ B2DPoint aEnd = aMRCorner + aEndVect;
+ aRetval.append( aStart );
+ aRetval.appendBezierSegment(
+ interpolate( aStart, aMRCorner, nKappa ),
+ interpolate( aEnd, aMRCorner, nKappa ),
+ aEnd );
+ }
+
+ // Create the bottom right angle
+ {
+ B2DPoint aBMCorner( aBounds.getWidth() - ARROW_WIDTH, aBounds.getHeight() );
+ B2DVector aStartVect( double( ARROW_WIDTH ), - aBounds.getHeight() / 2.0 );
+ aStartVect.setLength( nRadius );
+ B2DPoint aStart = aBMCorner + aStartVect;
+ B2DPoint aEnd = aBMCorner + B2DVector( - nRadius, 0.0 );
+ aRetval.append( aStart );
+ aRetval.appendBezierSegment(
+ interpolate( aStart, aBMCorner, nKappa ),
+ interpolate( aEnd, aBMCorner, nKappa ),
+ aEnd );
+ }
+
+ // Create the bottom left corner
+ {
+ B2DPoint aBLCorner( aBounds.getMinX(), aBounds.getHeight() );
+ B2DPoint aStart( nRadius, aBounds.getHeight() );
+ B2DPoint aEnd( 0.0, aBounds.getHeight() - nRadius );
+ aRetval.append( aStart );
+ aRetval.appendBezierSegment(
+ interpolate( aStart, aBLCorner, nKappa ),
+ interpolate( aEnd, aBLCorner, nKappa ),
+ aEnd );
+ }
+
+ aRetval.setClosed( true );
+ return aRetval;
+ }
+}
+
+SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ) :
+ MenuButton( pEditWin, WB_DIALOGCONTROL ),
+ SwFrameControl( pEditWin, pPageFrm ),
+ m_pPopupMenu( NULL ),
+ m_pLine( NULL )
+{
+ // Use pixels for the rest of the drawing
+ SetMapMode( MapMode ( MAP_PIXEL ) );
+
+ // Create the line control
+ BColor aColor = SwViewOption::GetPageBreakColor().getBColor();
+ m_pLine = new SwDashedLine( GetEditWin(), aColor );
+
+ // Create the popup menu
+ m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) );
+ SetPopupMenu( m_pPopupMenu );
+}
+
+SwPageBreakWin::~SwPageBreakWin( )
+{
+ delete m_pPopupMenu;
+ delete m_pLine;
+}
+
+void SwPageBreakWin::Paint( const Rectangle& )
+{
+ const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) );
+
+ // Properly paint the control
+ BColor aColor = SwViewOption::GetPageBreakColor().getBColor();
+
+ BColor aHslLine = rgb2hsl( aColor );
+ double nLuminance = aHslLine.getZ();
+ nLuminance += ( 1.0 - nLuminance ) * 0.75;
+ if ( aHslLine.getZ() > 0.7 )
+ nLuminance = aHslLine.getZ() * 0.7;
+ aHslLine.setZ( nLuminance );
+ BColor aOtherColor = hsl2rgb( aHslLine );
+
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ if ( rSettings.GetHighContrastMode( ) )
+ {
+ aColor = rSettings.GetDialogTextColor().getBColor();
+ aOtherColor = rSettings.GetDialogColor( ).getBColor();
+ }
+
+ Primitive2DSequence aSeq( 2 );
+ B2DRectangle aBRect( double( aRect.Left() ), double( aRect.Top( ) ),
+ double( aRect.Right() ), double( aRect.Bottom( ) ) );
+ B2DPolygon aPolygon = lcl_CreatePolygon( aBRect );
+
+ // Create the polygon primitives
+ aSeq[0] = Primitive2DReference( new PolyPolygonColorPrimitive2D(
+ B2DPolyPolygon( aPolygon ), aOtherColor ) );
+ aSeq[1] = Primitive2DReference( new PolygonHairlinePrimitive2D(
+ aPolygon, aColor ) );
+
+ // Create the processor and process the primitives
+ const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
+ drawinglayer::processor2d::BaseProcessor2D * pProcessor =
+ sdr::contact::createBaseProcessor2DFromOutputDevice(
+ *this, aNewViewInfos );
+
+ pProcessor->process( aSeq );
+
+ // Paint the picture
+ Image aImg( SW_RES( IMG_PAGE_BREAK ) );
+ DrawImage( Point( 3, 3 ), aImg );
+
+ // Paint the symbol if not readonly button
+ if ( IsEnabled() )
+ {
+ Point aPicPos( aRect.getWidth() - ARROW_WIDTH, 0 );
+ Size aPicSize( ARROW_WIDTH, aRect.getHeight() );
+ Rectangle aSymbolRect( aPicPos, aPicSize );
+
+ // 10% distance to the left
+ const long nBorderDistanceLeft = ((aSymbolRect.GetWidth()*100)+500)/1000;
+ aSymbolRect.Left()+=nBorderDistanceLeft;
+ // 40% distance to the right
+ const long nBorderDistanceRight = ((aSymbolRect.GetWidth()*400)+500)/1000;
+ aSymbolRect.Right()-=nBorderDistanceRight;
+ // 30% distance to the top button border
+ const long nBorderDistanceTop = ((aSymbolRect.GetHeight()*300)+500)/1000;
+ aSymbolRect.Top()+=nBorderDistanceTop;
+ // 25% distance to the bottom button border
+ const long nBorderDistanceBottom = ((aSymbolRect.GetHeight()*250)+500)/1000;
+ aSymbolRect.Bottom()-=nBorderDistanceBottom;
+
+ SymbolType nSymbol = SYMBOL_SPIN_DOWN;
+ DecorationView aDecoView( this );
+ aDecoView.DrawSymbol( aSymbolRect, nSymbol,
+ ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? Color( COL_WHITE )
+ : Color( COL_BLACK ) ) );
+ }
+}
+
+void SwPageBreakWin::Select( )
+{
+ // TODO Menu item selected...
+}
+
+void SwPageBreakWin::UpdatePosition( )
+{
+ const SwPageFrm* pPrevPage = static_cast< const SwPageFrm* >( GetPageFrame()->GetPrev() );
+ Rectangle aPrevFrmRect = GetEditWin()->LogicToPixel( pPrevPage->Frm().SVRect() );
+ Rectangle aBoundRect = GetEditWin()->LogicToPixel( GetPageFrame()->GetBoundRect().SVRect() );
+ Rectangle aFrmRect = GetEditWin()->LogicToPixel( GetPageFrame()->Frm().SVRect() );
+
+ long nYLineOffset = ( aPrevFrmRect.Bottom() + aFrmRect.Top() ) / 2;
+ if ( aFrmRect.Top() == aPrevFrmRect.Top() )
+ nYLineOffset = ( aBoundRect.Top() + aFrmRect.Top() ) / 2;
+
+ Size aBtnSize( BUTTON_SIZE + ARROW_WIDTH, BUTTON_SIZE );
+ Point aBtnPos( aFrmRect.Left() - aBtnSize.Width() + ARROW_WIDTH / 2,
+ nYLineOffset - aBtnSize.Height() / 2 );
+
+ SetPosSizePixel( aBtnPos, aBtnSize );
+
+ // Update the line position
+ Point aLinePos( aFrmRect.Left() + ARROW_WIDTH / 2, nYLineOffset );
+ Size aLineSize( aBoundRect.getWidth(), 1 );
+ m_pLine->SetPosSizePixel( aLinePos, aLineSize );
+}
+
+void SwPageBreakWin::ShowAll( bool bShow )
+{
+ Show( bShow );
+ m_pLine->Show( bShow );
+}
+
+const SwPageFrm* SwPageBreakWin::GetPageFrame( )
+{
+ return static_cast< const SwPageFrm * >( GetFrame( ) );
+}
+
+void SwPageBreakWin::SetReadonly( bool bReadonly )
+{
+ Enable( !bReadonly );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/inc/FrameControlsManager.hxx b/sw/source/ui/inc/FrameControlsManager.hxx
index a37305bbc3eb..c3e91ee4d920 100644
--- a/sw/source/ui/inc/FrameControlsManager.hxx
+++ b/sw/source/ui/inc/FrameControlsManager.hxx
@@ -65,6 +65,7 @@ class SwFrameControlsManager
// Helper methods
void SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset );
+ void SetPageBreakControl( const SwPageFrm* pPageFrm );
};
#endif
diff --git a/sw/source/ui/inc/HeaderFooterWin.hxx b/sw/source/ui/inc/HeaderFooterWin.hxx
index bbb93b209172..5ab8ef5041ee 100644
--- a/sw/source/ui/inc/HeaderFooterWin.hxx
+++ b/sw/source/ui/inc/HeaderFooterWin.hxx
@@ -29,7 +29,6 @@
#define _HEADERFOOTERWINDOW_HXX
#include <FrameControl.hxx>
-#include <pagedesc.hxx>
#include <vcl/menubtn.hxx>
diff --git a/sw/source/ui/inc/PageBreakWin.hxx b/sw/source/ui/inc/PageBreakWin.hxx
new file mode 100644
index 000000000000..117dc9cf7658
--- /dev/null
+++ b/sw/source/ui/inc/PageBreakWin.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 SUSE <cbosdonnat@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef _PAGEBREAKWINDOW_HXX
+#define _PAGEBREAKWINDOW_HXX
+
+#include <FrameControl.hxx>
+
+#include <vcl/menubtn.hxx>
+
+class SwPageFrm;
+
+/** Class for the page break control window.
+
+ This control shows a line indicating a manual page break and a
+ button providing a few actions on that page break.
+ */
+class SwPageBreakWin : public MenuButton, public SwFrameControl
+{
+ PopupMenu* m_pPopupMenu;
+ Window* m_pLine;
+
+public:
+ SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm );
+ ~SwPageBreakWin( );
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Select( );
+
+ void UpdatePosition( );
+
+ void ShowAll( bool bShow );
+
+ const SwPageFrm* GetPageFrame( );
+
+ void SetReadonly( bool bReadonly );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/inc/popup.hrc b/sw/source/ui/inc/popup.hrc
index c7ec2cfe1916..7edb6dadeecc 100644
--- a/sw/source/ui/inc/popup.hrc
+++ b/sw/source/ui/inc/popup.hrc
@@ -49,8 +49,9 @@
#define MN_REDCOMMENT_POPUPMENU (RC_POPUPS_BEGIN + 16)
#define MN_REDCOMMENT_BUTTON (RC_POPUPS_BEGIN + 17)
#define MN_HEADERFOOTER_BUTTON (RC_POPUPS_BEGIN + 18)
+#define MN_PAGEBREAK_BUTTON (RC_POPUPS_BEGIN + 19)
-#if MN_HEADERFOOTER_POPUPMENU > RC_POPUPS_END
+#if MN_PAGEBREAK_POPUPMENU > RC_POPUPS_END
#error Resource-Id Ueberlauf in #file, #line
#endif
diff --git a/sw/source/ui/inc/utlui.hrc b/sw/source/ui/inc/utlui.hrc
index 517ac26514a9..c5b2d0255850 100644
--- a/sw/source/ui/inc/utlui.hrc
+++ b/sw/source/ui/inc/utlui.hrc
@@ -162,6 +162,7 @@
#define IMG_VIEWLAYOUT_BOOKMODE_ACTIVE (RC_UTLUI_BEGIN + 15)
#define IMG_VIEWLAYOUT_SINGLECOLUMN (RC_UTLUI_BEGIN + 16)
#define IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE (RC_UTLUI_BEGIN + 17)
+#define IMG_PAGE_BREAK (RC_UTLUI_BEGIN + 18)
//local ids of the Database ImageLists
diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src
index db93aceacc04..5087b5f0934b 100644
--- a/sw/source/ui/utlui/utlui.src
+++ b/sw/source/ui/utlui/utlui.src
@@ -369,6 +369,15 @@ Image IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE
};
MaskColor = IMAGE_MASK_COLOR;
};
+Image IMG_PAGE_BREAK
+{
+ ImageBitmap = Bitmap
+ {
+ File = "page_break.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
String STR_HYPERCTRL_SEL
{
Text [ en-US ] = "SEL";