[Libreoffice-commits] .: 27 commits - drawinglayer/inc drawinglayer/prj drawinglayer/source editeng/CppunitTest_editeng_borderline.mk editeng/inc editeng/Library_editeng.mk editeng/prj editeng/qa editeng/source svx/inc svx/source xmloff/inc xmloff/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Sat Mar 19 10:18:37 PDT 2011
drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 81 -
drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx | 80 +
drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 1
drawinglayer/prj/d.lst | 1
drawinglayer/source/primitive2d/borderlineprimitive2d.cxx | 363 ++++---
drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx | 81 +
drawinglayer/source/primitive2d/makefile.mk | 1
editeng/CppunitTest_editeng_borderline.mk | 64 +
editeng/Library_editeng.mk | 1
editeng/inc/editeng/borderline.hxx | 103 +-
editeng/inc/editeng/editrids.hrc | 30
editeng/prj/build.lst | 1
editeng/qa/items/borderline_test.cxx | 133 ++
editeng/qa/items/makefile.mk | 94 +
editeng/qa/items/version.map | 34
editeng/source/items/borderline.cxx | 492 ++++++++++
editeng/source/items/frmitems.cxx | 262 +----
editeng/source/items/makefile.mk | 1
editeng/source/items/svxitems.src | 64 -
editeng/source/rtf/rtfitem.cxx | 302 +-----
svx/inc/svx/framelink.hxx | 139 ++
svx/inc/svx/framelinkarray.hxx | 8
svx/inc/svx/frmsel.hxx | 8
svx/inc/svx/sdr/contact/objectcontacttools.hxx | 3
svx/source/dialog/framelink.cxx | 260 ++++-
svx/source/dialog/framelinkarray.cxx | 202 ++++
svx/source/dialog/frmsel.cxx | 44
svx/source/inc/frmselimpl.hxx | 4
svx/source/table/svdotable.cxx | 78 -
svx/source/table/viewcontactoftableobj.cxx | 265 ++---
svx/source/tbxctrls/tbcontrl.cxx | 360 +------
xmloff/inc/XMLTextColumnsContext.hxx | 1
xmloff/inc/XMLTextColumnsExport.hxx | 1
xmloff/inc/xmloff/PageMasterStyleMap.hxx | 1
xmloff/inc/xmloff/xmltoken.hxx | 1
xmloff/source/core/xmltoken.cxx | 1
xmloff/source/style/PageMasterExportPropMapper.cxx | 5
xmloff/source/style/PageMasterImportPropMapper.cxx | 3
xmloff/source/style/PageMasterStyleMap.cxx | 1
xmloff/source/style/XMLFootnoteSeparatorExport.cxx | 22
xmloff/source/style/XMLFootnoteSeparatorImport.cxx | 23
xmloff/source/style/bordrhdl.cxx | 256 +----
xmloff/source/text/XMLTextColumnsContext.cxx | 29
xmloff/source/text/XMLTextColumnsExport.cxx | 23
xmloff/source/text/txtexppr.cxx | 8
xmloff/source/text/txtimppr.cxx | 1
46 files changed, 2479 insertions(+), 1457 deletions(-)
New commits:
commit 63c1fecf1728ea3c57a238824e4cee20cc32adaa
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Fri Mar 18 15:33:43 2011 +0100
hairline borders were never displayed
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index efd30cc..33df59c 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -83,7 +83,7 @@ namespace drawinglayer
{
Primitive2DSequence xRetval;
- if(!getStart().equal(getEnd()) && getWidth() > 0)
+ if(!getStart().equal(getEnd()) && ( isInsideUsed() || isOutsideUsed() ) )
{
// get data and vectors
const double fWidth(getWidth());
@@ -120,8 +120,8 @@ namespace drawinglayer
aLeft,
getRGBColorLeft()));
- aGap.append( aTmpStart );
- aGap.append( aTmpEnd );
+ aGap.append( getStart() - getExtendLeftStart() * aVector );
+ aGap.append( getEnd() + getExtendLeftEnd() * aVector );
}
else
{
@@ -165,8 +165,8 @@ namespace drawinglayer
aRight,
getRGBColorRight()));
- aGap.append( aTmpEnd );
- aGap.append( aTmpStart );
+ aGap.append( getStart() - getExtendRightStart() * aVector );
+ aGap.append( getEnd() + getExtendRightEnd() * aVector );
}
else
{
@@ -226,8 +226,8 @@ namespace drawinglayer
if(bIsHairline)
{
// create hairline primitive
- aPolygon.append(aTmpStart);
- aPolygon.append(aTmpEnd);
+ aPolygon.append( getStart() );
+ aPolygon.append( getEnd() );
xRetval[0] = Primitive2DReference(new PolygonHairlinePrimitive2D(
aPolygon,
commit 932d6c7f30e62e8aadb5e430320928d15fa104c5
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Fri Mar 18 13:00:00 2011 +0100
Fixed line style toobar control to display all line styles
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index c37dff9..180f3cb 100755
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -34,6 +34,7 @@
#include <string>
#include <tools/shl.hxx>
+#include <tools/color.hxx>
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <vcl/toolbox.hxx>
@@ -117,7 +118,6 @@ using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -284,12 +284,10 @@ public:
class SvxLineWindow_Impl : public SfxPopupWindow
{
private:
- ValueSet aLineSet;
+ LineListBox m_aLineStyleLb;
bool m_bIsWriter;
#if _SOLAR__PRIVATE
- void MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr,
- const ::Color& rLine, const ::Color& rBack );
DECL_LINK( SelectHdl, void * );
#endif
@@ -299,11 +297,9 @@ protected:
virtual Window* GetPreferredKeyInputWindow();
virtual void GetFocus();
virtual void DataChanged( const DataChangedEvent& rDCEvt );
- void CreateBitmaps( void );
public:
SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow );
- void StartSelection();
virtual SfxPopupWindow* Clone() const;
};
@@ -1328,12 +1324,15 @@ sal_Bool SvxFrameWindow_Impl::Close()
//========================================================================
// class SvxLineWindow_Impl --------------------------------------------------
//========================================================================
+Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
+{
+ return SvxBorderLine::threeDMediumColor( aMain );
+}
SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
- SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP ) ),
-
- aLineSet( this, WinBits( WB_3DLOOK | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_NONEFIELD | WB_NO_DIRECTSELECT ) )
+ SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_AUTOSIZE ) ),
+ m_aLineStyleLb( this )
{
try
{
@@ -1343,19 +1342,46 @@ SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame
catch(const uno::Exception& )
{
}
- Size aBmpSize( 55, 12 );
- CreateBitmaps();
- aLineSet.SetColCount( 2 );
- aLineSet.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
- aLineSet.SetText( SVX_RESSTR(STR_NONE) );
+ m_aLineStyleLb.SetPosSizePixel( 2, 2, 110, 140 );
+ SetOutputSizePixel( Size( 114, 144 ) );
+
+ m_aLineStyleLb.SetSourceUnit( FUNIT_TWIP );
+ m_aLineStyleLb.SetNone( SVX_RESSTR(STR_NONE) );
- aLineSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) );
- lcl_CalcSizeValueSet( *this, aLineSet, aBmpSize );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
+
+ // Double lines
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
+
+ // Engraved / Embossed
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
+ &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
+ &lcl_mediumColor );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
+ &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
+ &lcl_mediumColor );
+
+ // Inset / Outset
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
+ &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
+ m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
+ &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
+ m_aLineStyleLb.SetWidth( 20 ); // 1pt by default
+
+ m_aLineStyleLb.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
SetHelpId( HID_POPUP_LINE );
SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) );
- aLineSet.Show();
+ m_aLineStyleLb.Show();
}
SfxPopupWindow* SvxLineWindow_Impl::Clone() const
@@ -1365,212 +1391,20 @@ SfxPopupWindow* SvxLineWindow_Impl::Clone() const
// -----------------------------------------------------------------------
-void SvxLineWindow_Impl::MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr,
- const ::Color& rLineCol, const ::Color& rBackCol )
-{
- VirtualDevice aVirDev( *this );
- Rectangle aRect( Point(2,0), Size(rSize.Width()-4,0) );
-
- // grau einfaerben und Bitmap sichern:
- aVirDev.SetOutputSizePixel( rSize );
- aVirDev.SetLineColor();
- aVirDev.SetFillColor( rBackCol );
- aVirDev.DrawRect( Rectangle( Point(0,0), rSize ) );
- aVirDev.SetFillColor( rLineCol );
-
- sal_uInt16 nLineWidth = 0;
- switch ( nNo )
- {
- case 1: // DEF_LINE_WIDTH_0
- aRect.Top() = 6;
- aRect.Bottom() = 6;
- aVirDev.DrawRect( aRect );
- break;
-
- case 2: // DEF_LINE_WIDTH_1
- aRect.Top() = 5;
- aRect.Bottom() = 6;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_1/20;
- break;
-
- case 3: // DEF_LINE_WIDTH_2
- aRect.Top() = 5;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_2/20;
- break;
-
- case 4: // DEF_LINE_WIDTH_3
- aRect.Top() = 4;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- aVirDev.DrawRect( Rectangle( Point(2,4), Point(37,7) ) );
- nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_3/20;
- break;
-
- case 5: // DEF_LINE_WIDTH_4
- aRect.Top() = 4;
- aRect.Bottom() = 8;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_4/20;
- break;
-
- case 6: // DEF_DOUBLE_LINE0
- aRect.Top() = 5;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE0_OUT+DEF_DOUBLE_LINE0_IN+DEF_DOUBLE_LINE0_DIST)/20;
- break;
-
- case 7: // DEF_DOUBLE_LINE7
- aRect.Top() = 4;
- aRect.Bottom() = 4;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE7_OUT+DEF_DOUBLE_LINE7_IN+DEF_DOUBLE_LINE7_DIST)/20;
- break;
-
- case 8: // DEF_DOUBLE_LINE1
- aRect.Top() = 4;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 8;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE1_OUT+DEF_DOUBLE_LINE1_IN+DEF_DOUBLE_LINE1_DIST)/20;
- break;
-
- case 9: // DEF_DOUBLE_LINE2
- aRect.Top() = 3;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 8;
- aRect.Bottom() = 10;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE2_OUT+DEF_DOUBLE_LINE2_IN+DEF_DOUBLE_LINE2_DIST)/20;
- break;
-
- case 10: // DEF_DOUBLE_LINE8
- aRect.Top() = 3;
- aRect.Bottom() = 4;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE8_OUT+DEF_DOUBLE_LINE8_IN+DEF_DOUBLE_LINE8_DIST)/20;
- break;
-
- case 11: // DEF_DOUBLE_LINE9
- aRect.Top() = 3;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 8;
- aRect.Bottom() = 8;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE9_OUT+DEF_DOUBLE_LINE9_IN+DEF_DOUBLE_LINE9_DIST)/20;
- break;
-
- case 12: // DEF_DOUBLE_LINE10
- aRect.Top() = 2;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 8;
- aRect.Bottom() = 8;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE10_OUT+DEF_DOUBLE_LINE10_IN+DEF_DOUBLE_LINE10_DIST)/20;
- break;
-
- case 13: // DEF_DOUBLE_LINE3
- aRect.Top() = 4;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE3_OUT+DEF_DOUBLE_LINE3_IN+DEF_DOUBLE_LINE3_DIST)/20;
- break;
-
- case 14: // DEF_DOUBLE_LINE4
- aRect.Top() = 4;
- aRect.Bottom() = 4;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 6;
- aRect.Bottom() = 7;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE4_OUT+DEF_DOUBLE_LINE4_IN+DEF_DOUBLE_LINE4_DIST)/20;
- break;
-
- case 15: // DEF_DOUBLE_LINE5
- aRect.Top() = 3;
- aRect.Bottom() = 5;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 8;
- aRect.Bottom() = 9;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE5_OUT+DEF_DOUBLE_LINE5_IN+DEF_DOUBLE_LINE5_DIST)/20;
- break;
-
- case 16: // DEF_DOUBLE_LINE6
- aRect.Top() = 3;
- aRect.Bottom() = 4;
- aVirDev.DrawRect( aRect );
- aRect.Top() = 7;
- aRect.Bottom() = 9;
- aVirDev.DrawRect( aRect );
- nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE6_OUT+DEF_DOUBLE_LINE6_IN+DEF_DOUBLE_LINE6_DIST)/20;
- break;
- case 17: // Dotted line
- aRect.Top() = 6;
- aRect.Bottom() = 6;
- aVirDev.SetLineColor( rLineCol );
- aVirDev.SetFillColor();
- svtools::DrawLine( aVirDev, aRect.LeftCenter(), aRect.RightCenter(), 1, DOTTED );
- break;
-
- case 18: // Dashed line
- aRect.Top() = 6;
- aRect.Bottom() = 6;
- aVirDev.SetLineColor( rLineCol );
- aVirDev.SetFillColor();
- svtools::DrawLine( aVirDev, aRect.LeftCenter(), aRect.RightCenter(), 1, DASHED );
- break;
-
- default:
- break;
- }
- if ( nLineWidth )
- {
- rStr = String::CreateFromInt32( nLineWidth );
- rStr.AppendAscii(" pt");
- }
- rBmp = aVirDev.GetBitmap( Point(0,0), rSize );
-}
-
-// -----------------------------------------------------------------------
-
IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
{
SvxLineItem aLineItem( SID_FRAME_LINESTYLE );
- SvxBorderStyle nStyle = NO_STYLE;
+ SvxBorderStyle nStyle = SvxBorderStyle( m_aLineStyleLb.GetSelectEntryStyle() );
- if ( aLineSet.GetSelectItemId( ) > 0 )
- nStyle = SvxBorderStyle( aLineSet.GetSelectItemId( ) - 1 );
-
- if ( nStyle != NO_STYLE )
+ if ( m_aLineStyleLb.GetSelectEntryPos( ) > 0 )
{
SvxBorderLine aTmp;
- // TODO Make it depend on a width field
- aTmp.SetWidth( DEF_LINE_WIDTH_0 );
+ aTmp.SetStyle( nStyle );
+ aTmp.SetWidth( 20 ); // TODO Make it depend on a width field
aLineItem.SetLine( &aTmp );
}
else
- aLineItem.SetLine( 0 );
+ aLineItem.SetLine( NULL );
if ( IsInPopupMode() )
EndPopupMode();
@@ -1581,11 +1415,6 @@ IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 );
aArgs[0].Value = a;
- /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
- This instance may be deleted in the meantime (i.e. when a dialog is opened
- while in Dispatch()), accessing members will crash in this case. */
- aLineSet.SetNoSelection();
-
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineStyle" )),
aArgs );
@@ -1596,14 +1425,7 @@ IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
void SvxLineWindow_Impl::Resize()
{
- lcl_ResizeValueSet( *this, aLineSet);
-}
-
-// -----------------------------------------------------------------------
-
-void SvxLineWindow_Impl::StartSelection()
-{
- aLineSet.StartSelection();
+ m_aLineStyleLb.Resize();
}
// -----------------------------------------------------------------------
@@ -1617,44 +1439,26 @@ sal_Bool SvxLineWindow_Impl::Close()
Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
{
- return &aLineSet;
+ return &m_aLineStyleLb;
}
// -----------------------------------------------------------------------
void SvxLineWindow_Impl::GetFocus()
{
- aLineSet.GrabFocus();
+ m_aLineStyleLb.GrabFocus();
}
void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
SfxPopupWindow::DataChanged( rDCEvt );
-
+#if 0
if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
{
CreateBitmaps();
Invalidate();
}
-}
-
-void SvxLineWindow_Impl::CreateBitmaps( void )
-{
- Size aBmpSize( 55, 12 );
- Bitmap aBmp;
- String aStr;
-
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- svtools::ColorConfig aColorConfig;
- ::Color aLineCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- ::Color aBackCol( rStyleSettings.GetWindowColor() );
- aLineSet.Clear();
-
- for( sal_uInt16 i = 1 ; i < 19 ; ++i )
- {
- MakeLineBitmap( i, aBmp, aBmpSize, aStr, aLineCol, aBackCol );
- aLineSet.InsertItem( i, aBmp, aStr );
- }
+#endif
}
// -----------------------------------------------------------------------
@@ -2626,7 +2430,6 @@ SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
{
SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() );
pLineWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS | FLOATWIN_POPUPMODE_ALLOWTEAROFF );
- pLineWin->StartSelection();
SetPopupWindow( pLineWin );
return pLineWin;
commit 6c7183cbcc497999f51b8a191d9f92e6dfd3de61
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Thu Mar 17 17:39:42 2011 +0100
Fixed line style in footnote format GUI and saved it to ODF
diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 741d933..d81bd80 100755
--- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -148,6 +148,7 @@
#define CTF_PM_FTN_LINE_ADJUST (XML_PM_CTF_START + 0x0064)
#define CTF_PM_FTN_LINE_DISTANCE (XML_PM_CTF_START + 0x0065)
#define CTF_PM_FTN_DISTANCE (XML_PM_CTF_START + 0x0066)
+#define CTF_PM_FTN_LINE_STYLE (XML_PM_CTF_START + 0x0067)
extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[];
extern const XMLPropertyMapEntry aXMLPageMasterHeaderImportStyleMap[];
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index ba8f59f..d361c38 100755
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -1075,6 +1075,7 @@ namespace xmloff { namespace token {
XML_LINE_NUMBER,
XML_LINE_SKEW,
XML_LINE_SPACING,
+ XML_LINE_STYLE,
XML_LINEAR,
XML_LINENUMBERING_CONFIGURATION,
XML_LINENUMBERING_SEPARATOR,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index fa7026c..0a11903 100755
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1082,6 +1082,7 @@ namespace xmloff { namespace token {
TOKEN( "line-number", XML_LINE_NUMBER ),
TOKEN( "line-skew", XML_LINE_SKEW ),
TOKEN( "line-spacing", XML_LINE_SPACING ),
+ TOKEN( "line-style", XML_LINE_STYLE ),
TOKEN( "linear", XML_LINEAR ),
TOKEN( "linenumbering-configuration", XML_LINENUMBERING_CONFIGURATION ),
TOKEN( "linenumbering-separator", XML_LINENUMBERING_SEPARATOR ),
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 75ef5b0..61449e7 100755
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -124,6 +124,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "FootnoteLineRelativeWidth", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_PERCENT8|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_WIDTH ),
PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ),
PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGTH ),
+ PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ),
// header
HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ),
diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
index 90b0e8d..04f1e15 100755
--- a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
@@ -74,6 +74,7 @@ void XMLFootnoteSeparatorExport::exportXML(
sal_Int8 nLineRelWidth = 0;
sal_Int32 nLineTextDistance = 0;
sal_Int16 nLineWeight = 0;
+ sal_Int8 nLineStyle = 0;
// find indices into property map and get values
sal_uInt32 nCount = pProperties->size();
@@ -106,6 +107,9 @@ void XMLFootnoteSeparatorExport::exportXML(
"received wrong property state index" );
rState.maValue >>= nLineWeight;
break;
+ case CTF_PM_FTN_LINE_STYLE:
+ rState.maValue >>= nLineStyle;
+ break;
}
}
@@ -135,6 +139,22 @@ void XMLFootnoteSeparatorExport::exportXML(
sBuf.makeStringAndClear());
}
+ // line style
+ static const SvXMLEnumMapEntry aXML_LineStyle_Enum[] =
+ {
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASH, 3 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+ if (rExport.GetMM100UnitConverter().convertEnum(
+ sBuf, nLineStyle, aXML_LineStyle_Enum ) )
+ {
+ rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LINE_STYLE,
+ sBuf.makeStringAndClear());
+ }
+
// adjustment
static const SvXMLEnumMapEntry aXML_HorizontalAdjust_Enum[] =
{
@@ -160,6 +180,8 @@ void XMLFootnoteSeparatorExport::exportXML(
rExport.GetMM100UnitConverter().convertColor(sBuf, nLineColor);
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_COLOR,
sBuf.makeStringAndClear());
+
+ // line-style
SvXMLElementExport aElem(rExport, XML_NAMESPACE_STYLE,
XML_FOOTNOTE_SEP, sal_True, sal_True);
diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
index c0d0e32..47238b3 100755
--- a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx
@@ -92,6 +92,7 @@ void XMLFootnoteSeparatorImport::StartElement(
sal_Int16 eLineAdjust = text::HorizontalAdjust_LEFT; // enum text::HorizontalAdjust
sal_Int32 nLineTextDistance = 0;
sal_Int32 nLineDistance = 0;
+ sal_Int8 nLineStyle = 0;
// iterate over xattribute list and fill values
sal_Int16 nLength = xAttrList->getLength();
@@ -152,6 +153,23 @@ void XMLFootnoteSeparatorImport::StartElement(
if (SvXMLUnitConverter::convertColor(aColor, sAttrValue))
nLineColor = (sal_Int32)aColor.GetColor();
}
+ else if (IsXMLToken( sLocalName, XML_LINE_STYLE ))
+ {
+ sal_uInt16 nTmpU;
+ static const SvXMLEnumMapEntry aXML_LineStyle_Enum[] =
+ {
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASH, 3 },
+ { XML_TOKEN_INVALID, 0 }
+ };
+
+ if (SvXMLUnitConverter::convertEnum(
+ nTmpU, sAttrValue, aXML_LineStyle_Enum))
+ nLineStyle = (sal_Int8)nTmpU;
+
+ }
}
}
@@ -169,6 +187,11 @@ void XMLFootnoteSeparatorImport::StartElement(
XMLPropertyState aLineColor( nIndex, aAny );
rProperties.push_back(aLineColor);
+ aAny <<= nLineStyle;
+ nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_LINE_STYLE);
+ XMLPropertyState aLineStyle( nIndex, aAny );
+ rProperties.push_back(aLineStyle);
+
aAny <<= nLineDistance;
nIndex = rMapper->FindEntryIndex(CTF_PM_FTN_DISTANCE);
XMLPropertyState aLineDistance( nIndex, aAny );
commit f62695deb4cc333247b625d1864ab6262fa02eb6
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Wed Mar 16 16:06:42 2011 +0100
Added column separator style in ODF
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
index 779f2e7..ce03950 100755
--- a/xmloff/inc/XMLTextColumnsContext.hxx
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -46,6 +46,7 @@ class XMLTextColumnsContext :public XMLElementPropertyContext
const ::rtl::OUString sSeparatorLineVerticalAlignment;
const ::rtl::OUString sIsAutomatic;
const ::rtl::OUString sAutomaticDistance;
+ const ::rtl::OUString sSeparatorLineStyle;
XMLTextColumnsArray_Impl *pColumns;
diff --git a/xmloff/inc/XMLTextColumnsExport.hxx b/xmloff/inc/XMLTextColumnsExport.hxx
index abbaeee..ea2cef3 100755
--- a/xmloff/inc/XMLTextColumnsExport.hxx
+++ b/xmloff/inc/XMLTextColumnsExport.hxx
@@ -43,6 +43,7 @@ class XMLTextColumnsExport
const ::rtl::OUString sSeparatorLineVerticalAlignment;
const ::rtl::OUString sIsAutomatic;
const ::rtl::OUString sAutomaticDistance;
+ const ::rtl::OUString sSeparatorLineStyle;
protected:
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index f843cc5..47d076d 100755
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -68,6 +68,7 @@ enum SvXMLSepTokenMapAttrs
XML_TOK_COLUMN_SEP_HEIGHT,
XML_TOK_COLUMN_SEP_COLOR,
XML_TOK_COLUMN_SEP_ALIGN,
+ XML_TOK_COLUMN_SEP_STYLE,
XML_TOK_COLUMN_SEP_END=XML_TOK_UNKNOWN
};
@@ -85,9 +86,19 @@ static SvXMLTokenMapEntry aColSepAttrTokenMap[] =
{ XML_NAMESPACE_STYLE, XML_COLOR, XML_TOK_COLUMN_SEP_COLOR },
{ XML_NAMESPACE_STYLE, XML_HEIGHT, XML_TOK_COLUMN_SEP_HEIGHT },
{ XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TOK_COLUMN_SEP_ALIGN },
+ { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_COLUMN_SEP_STYLE },
XML_TOKEN_MAP_END
};
+SvXMLEnumMapEntry const pXML_Sep_Style_Enum[] =
+{
+ { XML_NONE, 0 },
+ { XML_SOLID, 1 },
+ { XML_DOTTED, 2 },
+ { XML_DASHED, 3 },
+ { XML_TOKEN_INVALID, 0 }
+};
+
SvXMLEnumMapEntry const pXML_Sep_Align_Enum[] =
{
{ XML_TOP, VerticalAlignment_TOP },
@@ -181,6 +192,7 @@ class XMLTextColumnSepContext_Impl: public SvXMLImportContext
sal_Int32 nWidth;
sal_Int32 nColor;
sal_Int8 nHeight;
+ sal_Int8 nStyle;
VerticalAlignment eVertAlign;
@@ -198,6 +210,7 @@ public:
sal_Int32 GetWidth() const { return nWidth; }
sal_Int32 GetColor() const { return nColor; }
sal_Int8 GetHeight() const { return nHeight; }
+ sal_Int8 GetStyle() const { return nStyle; }
VerticalAlignment GetVertAlign() const { return eVertAlign; }
};
@@ -214,6 +227,7 @@ XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl(
nWidth( 2 ),
nColor( 0 ),
nHeight( 100 ),
+ nStyle( 1 ),
eVertAlign( VerticalAlignment_TOP )
{
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -257,6 +271,15 @@ XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl(
eVertAlign = (VerticalAlignment)nAlign;
}
break;
+ case XML_TOK_COLUMN_SEP_STYLE:
+ {
+ sal_uInt16 nStyleVal;
+ if( GetImport().GetMM100UnitConverter().
+ convertEnum( nStyleVal, rValue,
+ pXML_Sep_Style_Enum ) )
+ nStyle = (sal_Int8)nStyleVal;
+ }
+ break;
}
}
}
@@ -287,6 +310,7 @@ XMLTextColumnsContext::XMLTextColumnsContext(
, sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment"))
, sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic"))
, sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
+, sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle"))
, pColumns( 0 )
, pColumnSep( 0 )
, pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) )
@@ -478,6 +502,11 @@ void XMLTextColumnsContext::EndElement( )
xPropSet->setPropertyValue( sSeparatorLineRelativeHeight,
aAny );
}
+ if ( pColumnSep->GetStyle() )
+ {
+ aAny <<= pColumnSep->GetStyle();
+ xPropSet->setPropertyValue( sSeparatorLineStyle, aAny );
+ }
aAny <<= pColumnSep->GetColor();
diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx
index b22af25..46e12a0 100755
--- a/xmloff/source/text/XMLTextColumnsExport.cxx
+++ b/xmloff/source/text/XMLTextColumnsExport.cxx
@@ -61,7 +61,8 @@ XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) :
sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")),
sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")),
sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")),
- sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
+ sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")),
+ sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle"))
{
}
@@ -133,12 +134,30 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_HEIGHT,
sValue.makeStringAndClear() );
+ // style::style
+ aAny = xPropSet->getPropertyValue( sSeparatorLineStyle );
+ sal_Int8 nStyle = 0;
+ aAny >>= nStyle;
+
+ enum XMLTokenEnum eStr = XML_TOKEN_INVALID;
+ switch ( nStyle )
+ {
+ case 0: eStr = XML_NONE; break;
+ case 1: eStr = XML_SOLID; break;
+ case 2: eStr = XML_DOTTED; break;
+ case 3: eStr = XML_DASHED; break;
+ default:
+ break;
+ }
+ if ( eStr != XML_TOKEN_INVALID )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE, eStr );
+
// style:vertical-align
aAny = xPropSet->getPropertyValue( sSeparatorLineVerticalAlignment );
VerticalAlignment eVertAlign;
aAny >>= eVertAlign;
- enum XMLTokenEnum eStr = XML_TOKEN_INVALID;
+ eStr = XML_TOKEN_INVALID;
switch( eVertAlign )
{
// case VerticalAlignment_TOP: eStr = XML_TOP;
commit b6e874de427a748156307d50cf6bf0ef89b0ffd1
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Mar 15 13:38:29 2011 +0100
Use bigger rectangle to be sure it will be clipped
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index afac9b9..efd30cc 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -95,8 +95,7 @@ namespace drawinglayer
if(isOutsideUsed() && isInsideUsed())
{
- double startMax = std::max( getExtendLeftStart(), std::max( getExtendRightStart(), 0.0 ) );
- double endMax = std::max( getExtendLeftEnd(), std::max( getExtendRightEnd(), 0.0 ) );
+ const double fExt = getWidth( ); // Extend a lot: it'll be clipped after
// both used, double line definition. Create left and right offset
xRetval.realloc(2);
@@ -107,8 +106,8 @@ namespace drawinglayer
{
// create geometry for left
const basegfx::B2DVector aLeftOff(aPerpendicular * (0.5 * (getCorrectedLeftWidth() - fWidth + 1)));
- const basegfx::B2DPoint aTmpStart(getStart() + aLeftOff - ( startMax * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + aLeftOff + ( endMax * aVector));
+ const basegfx::B2DPoint aTmpStart(getStart() + aLeftOff - ( fExt * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + aLeftOff + ( fExt * aVector));
basegfx::B2DPolygon aLeft;
if(leftIsHairline())
@@ -152,8 +151,8 @@ namespace drawinglayer
{
// create geometry for right
const basegfx::B2DVector aRightOff(aPerpendicular * (0.5 * (fWidth - getCorrectedRightWidth() + 1)));
- const basegfx::B2DPoint aTmpStart(getStart() + aRightOff - ( startMax * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + aRightOff + ( endMax * aVector));
+ const basegfx::B2DPoint aTmpStart(getStart() + aRightOff - ( fExt * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + aRightOff + ( fExt * aVector));
basegfx::B2DPolygon aRight;
if(rightIsHairline())
commit 803cf87450b5a14c51e6b9c263748f4cbf4d00ee
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Mar 15 13:37:56 2011 +0100
Fixed typo conditionning the display of BLTR borders
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index ba6bdc9..c803bc4 100755
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -1046,7 +1046,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D* pProcessor,
aTlbrStyle, aRect ) );
const Style aBltrStyle = GetCellStyleBLTR( _nFirstCol, _nFirstRow, true );
- if ( aTlbrStyle.GetWidth( ) )
+ if ( aBltrStyle.GetWidth( ) )
pProcessor->process( CreateClippedBorderPrimitives(
aRect.BottomLeft(), aRect.TopRight(),
aBltrStyle, aRect ) );
commit aa9530e734936ace04d900ec1cf7ef7fdfc728de
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Mar 15 13:37:10 2011 +0100
No tools value for pi or the basegfx methods will give unprecise results
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index b40aae6..9dfa353 100755
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1389,7 +1389,7 @@ double lcl_GetExtent( const Style& rBorder, const Style& rSide, const Style& rOp
basegfx::B2DPoint aBasePoint( 0.0, static_cast<double>( rBorder.GetWidth() / 2 ) );
basegfx::B2DHomMatrix aRotation;
- aRotation.rotate( nOtherAngle * F_PI18000 );
+ aRotation.rotate( double( nOtherAngle ) * M_PI / 18000.0 );
basegfx::B2DVector aOtherVector = aRotation * aBaseVector;
// Compute a line shifted by half the width of the other border
@@ -1401,6 +1401,7 @@ double lcl_GetExtent( const Style& rBorder, const Style& rSide, const Style& rOp
basegfx::tools::findCut(
aBasePoint, aBaseVector, aOtherPoint, aOtherVector,
CUTFLAG_ALL, &nCut );
+
return nCut;
}
commit 066ff6ecfc23bb7e854642a153417e516ec4f1b2
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Mon Mar 14 15:23:24 2011 +0100
sc: draw slanted borders using the drawinglayer primitives
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 95866f0..afac9b9 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -57,12 +57,22 @@ namespace drawinglayer
// Get the points
const basegfx::B2DVector aLeftOff(aPerpendicular * (-0.5 * (getWidth())));
const basegfx::B2DVector aRightOff(aPerpendicular * (0.5 * (getWidth())));
- clipPolygon.append( basegfx::B2DPoint(getStart() + aLeftOff - (getExtendLeftStart() * aVector)) );
+
+ const basegfx::B2DVector aSLVector( aLeftOff - ( getExtendLeftStart() * aVector ) );
+ clipPolygon.append( basegfx::B2DPoint( getStart() + aSLVector * 2.0 ) );
+
clipPolygon.append( getStart( ) );
- clipPolygon.append( basegfx::B2DPoint(getStart() + aRightOff - (getExtendRightStart() * aVector)) );
- clipPolygon.append( basegfx::B2DPoint(getEnd() + aRightOff + (getExtendRightEnd() * aVector)) );
+
+ const basegfx::B2DVector aSRVector( aRightOff - ( getExtendRightStart() * aVector ) );
+ clipPolygon.append( basegfx::B2DPoint( getStart() + aSRVector * 2.0 ) );
+
+ const basegfx::B2DVector aERVector( aRightOff + ( getExtendRightEnd() * aVector ) );
+ clipPolygon.append( basegfx::B2DPoint( getEnd() + aERVector * 2.0 ) );
+
clipPolygon.append( getEnd( ) );
- clipPolygon.append( basegfx::B2DPoint(getEnd() + aLeftOff + (getExtendLeftEnd() * aVector)) );
+
+ const basegfx::B2DVector aELVector( aLeftOff + ( getExtendLeftEnd() * aVector ) );
+ clipPolygon.append( basegfx::B2DPoint( getEnd() + aELVector * 2.0 ) );
clipPolygon.setClosed( true );
@@ -198,12 +208,9 @@ namespace drawinglayer
{
// single line, create geometry
basegfx::B2DPolygon aPolygon;
- const double fMaxExtStart = std::max( getExtendLeftStart(),
- std::max( getExtendRightStart(), 0.0 ) );
- const double fMaxExtEnd = std::max( getExtendLeftEnd(),
- std::max( getExtendRightEnd(), 0.0 ) );
- const basegfx::B2DPoint aTmpStart(getStart() - (fMaxExtStart * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + (fMaxExtEnd * aVector));
+ const double fExt = getWidth( ); // Extend a lot: it'll be clipped after
+ const basegfx::B2DPoint aTmpStart(getStart() - (fExt * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + (fExt * aVector));
xRetval.realloc(1);
// Get which is the line to show
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
index 2d550d1..a2cd8e5 100755
--- a/svx/inc/svx/framelink.hxx
+++ b/svx/inc/svx/framelink.hxx
@@ -513,14 +513,9 @@ SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimiti
const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
const DiagStyle& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
- const Color* pForceColor = 0 /// If specified, overrides frame border color.
-);
-
-SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
- const Point& rLPos, /// Reference point for left end of the processed frame border.
- const Point& rRPos, /// Reference point for right end of the processed frame border.
- const Style& rBorder, /// Style of the frame border to draw.
- const Color* pForceColor = 0 /// If specified, overrides frame border color.
+ const Color* pForceColor = 0,/// If specified, overrides frame border color.
+ const long& rRotationT = 9000, /// Angle of the top slanted frames in 100th of degree
+ const long& rRotationB = 9000 /// Angle of the bottom slanted frames in 100th of degree
);
SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
@@ -536,7 +531,9 @@ SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimiti
const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
- const Color* pForceColor = 0 /// If specified, overrides frame border color.
+ const Color* pForceColor = 0,/// If specified, overrides frame border color.
+ const long& rRotationT = 9000, /// Angle of the top slanted frame in 100th of degrees
+ const long& rRotationB = 9000 /// Angle of the bottom slanted frame in 100th of degrees
);
SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
@@ -763,25 +760,6 @@ void SVX_DLLPUBLIC DrawVerFrameBorder(
const Color* pForceColor = 0 /// If specified, overrides frame border color.
);
-// ----------------------------------------------------------------------------
-
-/** Draws a vertical slanted frame border without connected frame styles.
-
- This is an extended version of the simple DrawVerFrameBorder() function
- described above. It accepts start and end reference points with different
- X coordinates. See description above for additional details about the
- parameters (except the restriction on the reference points).
-
- The function preserves all settings of the passed output device.
- */
-void SVX_DLLPUBLIC DrawVerFrameBorderSlanted(
- OutputDevice& rDev, /// The output device used to draw the frame border.
- const Point& rTPos, /// Reference point for top end of the processed frame border.
- const Point& rBPos, /// Reference point for bottom end of the processed frame border.
- const Style& rBorder, /// Style of the frame border to draw.
- const Color* pForceColor = 0 /// If specified, overrides frame border color.
-);
-
// ============================================================================
/** Draws both diagonal frame borders, regards all connected frame styles.
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index fa79a0a..b40aae6 100755
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1366,19 +1366,45 @@ bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
// Drawing functions
// ============================================================================
-double lcl_GetExtent( const Style& rSide, const Style& rOpposite )
+double lcl_GetExtent( const Style& rBorder, const Style& rSide, const Style& rOpposite,
+ long nAngleSide = 9000, long nAngleOpposite = 9000 )
{
- double nExtent = 0.0;
+ Style aOtherBorder = const_cast< Style& >( rSide );
+ long nOtherAngle = nAngleSide;
+ if ( rSide.GetWidth() == 0 && rOpposite.GetWidth() > 0 )
+ {
+ nOtherAngle = nAngleOpposite;
+ aOtherBorder = const_cast< Style& >( rOpposite );
+ }
+ else if ( rSide.GetWidth() == 0 && rOpposite.GetWidth() == 0 )
+ {
+ if ( ( nAngleOpposite % 18000 ) == 0 )
+ nOtherAngle = nAngleSide;
+ else if ( ( nAngleSide % 18000 ) == 0 )
+ nOtherAngle = nAngleOpposite;
+ }
- if ( rSide.Prim() + rSide.Secn() > 0 )
- nExtent = - rSide.GetWidth( ) / 2.0;
- else
- nExtent = rOpposite.GetWidth() / 2.0;
+ // Let's assume the border we are drawing is horizontal and compute all the angles / distances from this
+ basegfx::B2DVector aBaseVector( 1.0, 0.0 );
+ basegfx::B2DPoint aBasePoint( 0.0, static_cast<double>( rBorder.GetWidth() / 2 ) );
- return nExtent;
+ basegfx::B2DHomMatrix aRotation;
+ aRotation.rotate( nOtherAngle * F_PI18000 );
+
+ basegfx::B2DVector aOtherVector = aRotation * aBaseVector;
+ // Compute a line shifted by half the width of the other border
+ basegfx::B2DVector aPerpendicular = basegfx::getNormalizedPerpendicular( aOtherVector );
+ basegfx::B2DPoint aOtherPoint = basegfx::B2DPoint() + aPerpendicular * aOtherBorder.GetWidth() / 2;
+
+ // Find the cut between the two lines
+ double nCut = 0.0;
+ basegfx::tools::findCut(
+ aBasePoint, aBaseVector, aOtherPoint, aOtherVector,
+ CUTFLAG_ALL, &nCut );
+ return nCut;
}
-basegfx::B2DPoint lcl_PointToB2DPoint( Point aPoint )
+basegfx::B2DPoint lcl_PointToB2DPoint( const Point aPoint )
{
return basegfx::B2DPoint( aPoint.getX(), aPoint.getY() );
}
@@ -1412,11 +1438,10 @@ drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
const Point& rLPos, const Point& rRPos, const Style& rBorder,
- const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
- const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL,
- const Color* pForceColor )
+ const DiagStyle& /*rLFromTR*/, const Style& rLFromT, const Style& /*rLFromL*/, const Style& rLFromB, const DiagStyle& /*rLFromBR*/,
+ const DiagStyle& /*rRFromTL*/, const Style& rRFromT, const Style& /*rRFromR*/, const Style& rRFromB, const DiagStyle& /*rRFromBL*/,
+ const Color* /*pForceColor*/, const long& nRotateT, const long& nRotateB )
{
- const DiagStyle aNoStyle;
drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 );
basegfx::B2DPoint aStart( rLPos.getX(), rLPos.getY() );
@@ -1427,10 +1452,10 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
rBorder.Prim(),
rBorder.Dist(),
rBorder.Secn(),
- lcl_GetExtent( rLFromT, rLFromB ),
- lcl_GetExtent( rRFromT, rRFromB ),
- lcl_GetExtent( rLFromB, rLFromT ),
- lcl_GetExtent( rRFromB, rRFromT ),
+ lcl_GetExtent( rBorder, rLFromT, rLFromB, nRotateT, - nRotateB ),
+ lcl_GetExtent( rBorder, rRFromT, rRFromB, 18000 - nRotateT, nRotateB - 18000 ),
+ lcl_GetExtent( rBorder, rLFromB, rLFromT, nRotateB, - nRotateT ),
+ lcl_GetExtent( rBorder, rRFromB, rRFromT, 18000 - nRotateB, nRotateT - 18000 ),
rBorder.GetColorSecn().getBColor(),
rBorder.GetColorPrim().getBColor(),
rBorder.GetColorGap().getBColor(),
@@ -1443,24 +1468,12 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
const Point& rLPos, const Point& rRPos, const Style& rBorder,
const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
- const Color* pForceColor )
+ const Color* pForceColor, const long& nRotateT, const long& nRotateB )
{
- const DiagStyle noDiagStyle;
return CreateBorderPrimitives( rLPos, rRPos, rBorder,
- noDiagStyle, rLFromT, rLFromL, rLFromB, noDiagStyle,
- noDiagStyle, rRFromT, rRFromR, rRFromB, noDiagStyle,
- pForceColor );
-}
-
-drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
- const Point& rLPos, const Point& rRPos,
- const Style& rBorder, const Color* pForceColor )
-{
- const Style noStyle;
- return CreateBorderPrimitives( rLPos, rRPos, rBorder,
- noStyle, noStyle, noStyle,
- noStyle, noStyle, noStyle,
- pForceColor );
+ DiagStyle(), rLFromT, rLFromL, rLFromB, DiagStyle(),
+ DiagStyle(), rRFromT, rRFromR, rRFromB, DiagStyle(),
+ pForceColor, nRotateT, nRotateB );
}
void DrawHorFrameBorder( OutputDevice& rDev,
@@ -1541,48 +1554,6 @@ void DrawVerFrameBorder( OutputDevice& rDev,
lclDrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, BorderResult(), pForceColor );
}
-// ----------------------------------------------------------------------------
-
-void DrawVerFrameBorderSlanted( OutputDevice& rDev,
- const Point& rTPos, const Point& rBPos, const Style& rBorder, const Color* pForceColor )
-{
- DBG_ASSERT( rTPos.Y() < rBPos.Y(), "svx::frame::DrawVerFrameBorderSlanted - wrong order of line ends" );
- if( rBorder.Prim() && (rTPos.Y() < rBPos.Y()) )
- {
- if( rTPos.X() == rBPos.X() )
- {
- DrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, pForceColor );
- }
- else
- {
- const LineEndResult aRes;
-
- Style aScaled( rBorder );
- aScaled.ScaleSelf( 1.0 / cos( GetVerDiagAngle( rTPos, rBPos ) ) );
-
- lclSetColorToOutDev( rDev, aScaled.GetColorPrim(), pForceColor );
- lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Type() );
- rDev.Pop(); // colors
- if( aScaled.Secn() )
- {
- if ( aScaled.UseGapColor( ) )
- {
- lclSetColorToOutDev( rDev, aScaled.GetColorGap(), pForceColor );
- lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetDistBeg( aScaled ), lclGetDistEnd( aScaled ), aScaled.Type() );
- rDev.Pop(); // colors
- }
-
- lclSetColorToOutDev( rDev, aScaled.GetColorSecn(), pForceColor );
- lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Type() );
- rDev.Pop(); // colors
- }
- }
- }
-}
-
// ============================================================================
void DrawDiagFrameBorders(
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index e756d24..ba6bdc9 100755
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -1038,8 +1038,6 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D* pProcessor,
{
size_t _nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
size_t _nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
- size_t _nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
- size_t _nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
const Style aTlbrStyle = GetCellStyleTLBR( _nFirstCol, _nFirstRow, true );
if ( aTlbrStyle.GetWidth( ) )
@@ -1214,6 +1212,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D* pProcessor,
aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR, pForceColor ) );
}
}
+
void Array::DrawRange( OutputDevice& rDev,
size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow,
const Color* pForceColor ) const
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 484f8ac..600a4a1 100755
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1851,84 +1851,6 @@ struct ImplTableShadowPaintInfo
// --------------------------------------------------------------------
-void lcl_VertLineEnds( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
- const Color& rColor, long nXOffs, long nWidth,
- const svx::frame::Style& rTopLine, const svx::frame::Style& rBottomLine )
-{
- rDev.SetLineColor(rColor); // PEN_NULL ???
- rDev.SetFillColor(rColor);
-
- // Position oben/unten muss unabhaengig von der Liniendicke sein,
- // damit der Winkel stimmt (oder X-Position auch anpassen)
- long nTopPos = rTop.Y();
- long nBotPos = rBottom.Y();
-
- long nTopLeft = rTop.X() + nXOffs;
- long nTopRight = nTopLeft + nWidth - 1;
-
- long nBotLeft = rBottom.X() + nXOffs;
- long nBotRight = nBotLeft + nWidth - 1;
-
- // oben abschliessen
-
- if ( rTopLine.Prim() )
- {
- long nLineW = rTopLine.GetWidth();
- if (nLineW >= 2)
- {
- Point aTriangle[3];
- aTriangle[0] = Point( nTopLeft, nTopPos ); // wie aPoints[0]
- aTriangle[1] = Point( nTopRight, nTopPos ); // wie aPoints[1]
- aTriangle[2] = Point( rTop.X(), nTopPos - (nLineW - 1) / 2 );
- Polygon aTriPoly( 3, aTriangle );
- rDev.DrawPolygon( aTriPoly );
- }
- }
-
- // unten abschliessen
-
- if ( rBottomLine.Prim() )
- {
- long nLineW = rBottomLine.GetWidth();
- if (nLineW >= 2)
- {
- Point aTriangle[3];
- aTriangle[0] = Point( nBotLeft, nBotPos ); // wie aPoints[3]
- aTriangle[1] = Point( nBotRight, nBotPos ); // wie aPoints[2]
- aTriangle[2] = Point( rBottom.X(), nBotPos - (nLineW - 1) / 2 + nLineW - 1 );
- Polygon aTriPoly( 3, aTriangle );
- rDev.DrawPolygon( aTriPoly );
- }
- }
-}
-
-void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
- const svx::frame::Style& rLine,
- const svx::frame::Style& rTopLine, const svx::frame::Style& rBottomLine,
- const Color* pForceColor )
-{
- if( rLine.Prim() )
- {
- svx::frame::DrawVerFrameBorderSlanted( rDev, rTop, rBottom, rLine, pForceColor );
-
- svx::frame::Style aScaled( rLine );
- aScaled.ScaleSelf( 1.0 / cos( svx::frame::GetVerDiagAngle( rTop, rBottom ) ) );
- if( pForceColor )
- aScaled.SetColorPrim( *pForceColor );
-
- long nXOffs = (aScaled.GetWidth() - 1) / -2L;
-
- lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(),
- nXOffs, aScaled.Prim(), rTopLine, rBottomLine );
-
- if( aScaled.Secn() )
- lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(),
- nXOffs + aScaled.Prim() + aScaled.Dist(), aScaled.Secn(), rTopLine, rBottomLine );
- }
-}
-
-// --------------------------------------------------------------------
-
void SdrTableObj::TakeObjNameSingul(XubString& rName) const
{
rName = ImpGetResStr(STR_ObjNameSingulTable);
commit 8fe4b54be1b618e066b9f3b8f8ea159dcd6beec6
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Feb 22 15:18:16 2011 +0100
svx::frame::DrawRange has now a drawinglayer equivalent
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 283c0be..1428a10 100755
--- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -120,9 +120,9 @@ namespace drawinglayer
return !basegfx::fTools::equalZero(mfRightWidth);
}
- basegfx::B2DPolyPolygon getClipPolygon( ) const;
-
protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon( ) const;
+
/// create local decomposition
virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
new file mode 100644
index 0000000..bae7908
--- /dev/null
+++ b/drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- 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. 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.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Novell Inc. ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Cédric Bosdonnat <cbosdonnat at novell.com>
+ *
+ * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D clipped by the intersection with a provided
+ polygon.
+ */
+ class ClippedBorderLinePrimitive2D : public BorderLinePrimitive2D
+ {
+ private:
+ const basegfx::B2DPolygon maIntersection;
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon( ) const;
+
+ public:
+ /// constructor
+ ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 7fe52b7..9c985a6 100755
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -104,6 +104,7 @@
#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst
index 54f087d..375889e 100755
--- a/drawinglayer/prj/d.lst
+++ b/drawinglayer/prj/d.lst
@@ -14,6 +14,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d
..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx
..\inc\drawinglayer\primitive2d\bitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\bitmapprimitive2d.hxx
..\inc\drawinglayer\primitive2d\borderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\borderlineprimitive2d.hxx
+..\inc\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\clippedborderlineprimitive2d.hxx
..\inc\drawinglayer\primitive2d\chartprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\chartprimitive2d.hxx
..\inc\drawinglayer\primitive2d\controlprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\controlprimitive2d.hxx
..\inc\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\discretebitmapprimitive2d.hxx
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 78b6cb1..95866f0 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -74,7 +74,7 @@ namespace drawinglayer
Primitive2DSequence xRetval;
if(!getStart().equal(getEnd()) && getWidth() > 0)
- {
+ {
// get data and vectors
const double fWidth(getWidth());
basegfx::B2DVector aVector(getEnd() - getStart());
diff --git a/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx
new file mode 100644
index 0000000..b97e90f
--- /dev/null
+++ b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx
@@ -0,0 +1,81 @@
+/* -*- 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. 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.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Novell Inc. ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Cédric Bosdonnat <cbosdonnat at novell.com>
+ *
+ * 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 <drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ basegfx::B2DPolyPolygon ClippedBorderLinePrimitive2D::getClipPolygon( ) const
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append( maIntersection );
+ return aPolyPolygon;
+ }
+
+ ClippedBorderLinePrimitive2D::ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle)
+ : BorderLinePrimitive2D( rStart, rEnd, fLeftWidth,fDistance, fRightWidth,
+ 0.0, 0.0, 0.0, 0.0, rRGBColorRight, rRGBColorLeft,
+ rRGBColorGap, bHasGapColor, nStyle),
+ maIntersection( rIntersection )
+ {
+ }
+
+ bool ClippedBorderLinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BorderLinePrimitive2D::operator==(rPrimitive))
+ {
+ const ClippedBorderLinePrimitive2D& rCompare = (ClippedBorderLinePrimitive2D&)rPrimitive;
+
+ return maIntersection == rCompare.maIntersection;
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(ClippedBorderLinePrimitive2D, PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D)
+
+
+ } // namespace primitive2d
+} // namespace drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk
index 720769a..092612f 100755
--- a/drawinglayer/source/primitive2d/makefile.mk
+++ b/drawinglayer/source/primitive2d/makefile.mk
@@ -43,6 +43,7 @@ SLOFILES= \
$(SLO)$/backgroundcolorprimitive2d.obj \
$(SLO)$/bitmapprimitive2d.obj \
$(SLO)$/borderlineprimitive2d.obj \
+ $(SLO)$/clippedborderlineprimitive2d.obj \
$(SLO)$/chartprimitive2d.obj \
$(SLO)$/controlprimitive2d.obj \
$(SLO)$/discretebitmapprimitive2d.obj \
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
index 6cfc8f0..2d550d1 100755
--- a/svx/inc/svx/framelink.hxx
+++ b/svx/inc/svx/framelink.hxx
@@ -461,22 +461,88 @@ SVX_DLLPUBLIC bool CheckFrameBorderConnectable(
// Drawing functions
// ============================================================================
+/** Draws a horizontal frame border, regards all connected frame styles.
+
+ The frame style to draw is passed as parameter rBorder. The function
+ calculates the adjustment in X direction for left and right end of primary
+ and secondary line of the frame border (the style may present a double
+ line). The line ends may differ according to the connected frame styles
+ coming from top, bottom, left, right, and/or diagonal.
+
+ Thick frame styles are always drawn centered (in width) to the passed
+ reference points. The Y coordinates of both reference points must be equal
+ (the line cannot be drawn slanted).
+
+ The function preserves all settings of the passed output device.
+
+ All parameters starting with "rL" refer to the left end of the processed
+ frame border, all parameters starting with "rR" refer to the right end.
+ The following part of the parameter name starting with "From" specifies
+ where the frame border comes from. Example: "rLFromTR" means the frame
+ border coming from top-right, connected to the left end of rBorder (and
+ therefore a diagonal frame border).
+
+ The follong picture shows the meaning of all passed parameters:
+
+ rLFromT / \ rRFromT
+ | / \ |
+ | rLFromTR rRFromTL |
+ | / \ |
+ | / \ |
+ --- rLFromL --- ============== rBorder ============== --- rRFromR ---
+ | \ / |
+ | \ / |
+ | rLFromBR rRFromBL |
+ | \ / |
+ rLFromB \ / rRFromB
+ */
SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
const Point& rLPos, /// Reference point for left end of the processed frame border.
const Point& rRPos, /// Reference point for right end of the processed frame border.
const Style& rBorder, /// Style of the processed frame border.
+ const DiagStyle& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
+ const DiagStyle& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
+ const DiagStyle& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
+ const DiagStyle& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the frame border to draw.
const Color* pForceColor = 0 /// If specified, overrides frame border color.
);
+SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
+ const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
+ const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
+
+ const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
+ const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
+ const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
+ const Point& rStart, const Point& rEnd, const Style& rBorder,
+ const Rectangle& rClipRect );
+
/** Draws a horizontal frame border, regards all connected frame styles.
The frame style to draw is passed as parameter rBorder. The function
diff --git a/svx/inc/svx/framelinkarray.hxx b/svx/inc/svx/framelinkarray.hxx
index 2b0e7b0..fd155d6 100755
--- a/svx/inc/svx/framelinkarray.hxx
+++ b/svx/inc/svx/framelinkarray.hxx
@@ -30,6 +30,7 @@
#define SVX_FRAMELINKARRAY_HXX
#include <svx/framelink.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <memory>
@@ -507,6 +508,13 @@ public:
If not NULL, only this color will be used to draw all frame borders. */
void DrawCell( OutputDevice& rDev, size_t nCol, size_t nRow,
const Color* pForceColor = 0 ) const;
+ /** Draws the part of the specified range, that is inside the clipping range.
+ @param pForceColor
+ If not NULL, only this color will be used to draw all frame borders. */
+ void DrawRange( drawinglayer::processor2d::BaseProcessor2D* rDev,
+ size_t nFirstCol, size_t nFirstRow,
+ size_t nLastCol, size_t nLastRow,
+ const Color* pForceColor = 0 ) const;
/** Draws the part of the specified range, that is inside the clipping range.
@param pForceColor
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 35758d7..fa79a0a 100755
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -56,6 +56,7 @@
#endif
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx>
namespace svx {
namespace frame {
@@ -1377,10 +1378,42 @@ double lcl_GetExtent( const Style& rSide, const Style& rOpposite )
return nExtent;
}
+basegfx::B2DPoint lcl_PointToB2DPoint( Point aPoint )
+{
+ return basegfx::B2DPoint( aPoint.getX(), aPoint.getY() );
+}
+
+drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
+ const Point& rStart, const Point& rEnd, const Style& rBorder,
+ const Rectangle& rClipRect )
+{
+ drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 );
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append( lcl_PointToB2DPoint( rClipRect.TopLeft( ) ) );
+ aPolygon.append( lcl_PointToB2DPoint( rClipRect.TopRight( ) ) );
+ aPolygon.append( lcl_PointToB2DPoint( rClipRect.BottomRight( ) ) );
+ aPolygon.append( lcl_PointToB2DPoint( rClipRect.BottomLeft( ) ) );
+ aPolygon.setClosed( true );
+
+ aSequence[0] = new drawinglayer::primitive2d::ClippedBorderLinePrimitive2D(
+ lcl_PointToB2DPoint( rStart ),
+ lcl_PointToB2DPoint( rEnd ),
+ rBorder.Prim(),
+ rBorder.Dist(),
+ rBorder.Secn(),
+ aPolygon,
+ rBorder.GetColorSecn().getBColor(),
+ rBorder.GetColorPrim().getBColor(),
+ rBorder.GetColorGap().getBColor(),
+ rBorder.UseGapColor(), rBorder.Type() );
+
+ return aSequence;
+}
+
drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
const Point& rLPos, const Point& rRPos, const Style& rBorder,
- const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
- const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL,
const Color* pForceColor )
{
const DiagStyle aNoStyle;
@@ -1389,32 +1422,11 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
basegfx::B2DPoint aStart( rLPos.getX(), rLPos.getY() );
basegfx::B2DPoint aEnd( rRPos.getX(), rRPos.getY() );
- // Compute the offset for the start and end points
- basegfx::B2DVector aVector( aStart - aEnd );
- aVector.normalize();
- double nOffStart = rBorder.GetWidth() / 2.0;
- double nOffEnd = rBorder.GetWidth() / 2.0;
- if ( aVector.getY( ) == 1.0 && aVector.getX() == 0.0 )
- {
- // Deal with vertical lines
- sal_uInt16 nWS1 = ( rLFromT.GetWidth() == 0 ) ? -1 : rLFromT.GetWidth( );
- sal_uInt16 nWS2 = ( rLFromB.GetWidth() == 0 ) ? -1 : rLFromB.GetWidth( );
- nOffStart = std::min( nWS1, nWS2 ) / 2.0;
-
- sal_uInt16 nWE1 = ( rRFromT.GetWidth() == 0 ) ? -1 : rRFromT.GetWidth( );
- sal_uInt16 nWE2 = ( rRFromB.GetWidth() == 0 ) ? -1 : rRFromB.GetWidth( );
- nOffEnd = std::min( nWE1, nWE2 ) / 2.0;
- }
-
- basegfx::B2DVector aOffsetV( 0.0, 1.0 );
- aStart = aStart + aOffsetV * nOffStart;
- aEnd = aEnd + aOffsetV * nOffEnd;
-
aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D(
aStart, aEnd,
- rBorder.Prim() + 1,
- rBorder.Dist() + 1,
- rBorder.Secn() + 1,
+ rBorder.Prim(),
+ rBorder.Dist(),
+ rBorder.Secn(),
lcl_GetExtent( rLFromT, rLFromB ),
lcl_GetExtent( rRFromT, rRFromB ),
lcl_GetExtent( rLFromB, rLFromT ),
@@ -1427,6 +1439,30 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
return aSequence;
}
+drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
+ const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
+ const Color* pForceColor )
+{
+ const DiagStyle noDiagStyle;
+ return CreateBorderPrimitives( rLPos, rRPos, rBorder,
+ noDiagStyle, rLFromT, rLFromL, rLFromB, noDiagStyle,
+ noDiagStyle, rRFromT, rRFromR, rRFromB, noDiagStyle,
+ pForceColor );
+}
+
+drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, const Point& rRPos,
+ const Style& rBorder, const Color* pForceColor )
+{
+ const Style noStyle;
+ return CreateBorderPrimitives( rLPos, rRPos, rBorder,
+ noStyle, noStyle, noStyle,
+ noStyle, noStyle, noStyle,
+ pForceColor );
+}
+
void DrawHorFrameBorder( OutputDevice& rDev,
const Point& rLPos, const Point& rRPos, const Style& rBorder,
const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index e778abc..e756d24 100755
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -1011,6 +1011,209 @@ void Array::DrawCell( OutputDevice& rDev, size_t nCol, size_t nRow, const Color*
DrawRange( rDev, nCol, nRow, nCol, nRow, pForceColor );
}
+void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D* pProcessor,
+ size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow,
+ const Color* pForceColor ) const
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "DrawRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "DrawRange" );
+
+ size_t nCol, nRow;
+
+ // *** diagonal frame borders ***
+ for( nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ for( nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ const Cell& rCell = CELL( nCol, nRow );
+ bool bOverlapX = rCell.mbOverlapX;
+ bool bOverlapY = rCell.mbOverlapY;
+ bool bFirstCol = nCol == nFirstCol;
+ bool bFirstRow = nRow == nFirstRow;
+ if( (!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) ||
+ (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow) )
+ {
+ Rectangle aRect( GetCellRect( nCol, nRow ) );
+ if( (aRect.GetWidth() > 1) && (aRect.GetHeight() > 1) )
+ {
+ size_t _nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t _nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t _nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t _nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+
+ const Style aTlbrStyle = GetCellStyleTLBR( _nFirstCol, _nFirstRow, true );
+ if ( aTlbrStyle.GetWidth( ) )
+ pProcessor->process( CreateClippedBorderPrimitives(
+ aRect.TopLeft(), aRect.BottomRight(),
+ aTlbrStyle, aRect ) );
+
+ const Style aBltrStyle = GetCellStyleBLTR( _nFirstCol, _nFirstRow, true );
+ if ( aTlbrStyle.GetWidth( ) )
+ pProcessor->process( CreateClippedBorderPrimitives(
+ aRect.BottomLeft(), aRect.TopRight(),
+ aBltrStyle, aRect ) );
+ }
+ }
+ }
+ }
+
+ // *** horizontal frame borders ***
+
+ for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow )
+ {
+ double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow );
+ double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 );
+
+ // *Start*** variables store the data of the left end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) );
+ const Style* pStart = &GetCellStyleTop( nFirstCol, nRow );
+ DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 );
+ const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow );
+ const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow );
+ DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle );
+
+ // *End*** variables store the data of the right end of the cached frame border
+ DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 );
+ const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow );
+ const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow );
+ DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle );
+
+ for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol )
+ {
+ fAngle = mxImpl->GetHorDiagAngle( nCol, nRow );
+ fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 );
+
+ const Style& rCurr = *pEndRFromR;
+
+ DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle );
+ const Style& rLFromT = *pEndRFromT;
+ const Style& rLFromL = *pStart;
+ const Style& rLFromB = *pEndRFromB;
+ DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle );
+ const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 );
+ const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow );
+ const Style& rRFromB = GetCellStyleRight( nCol, nRow );
+ DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ pProcessor->process( CreateBorderPrimitives( aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor ) );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartLFromTR = aLFromTR;
+ pStartLFromT = &rLFromT;
+ pStartLFromL = &rLFromL;
+ pStartLFromB = &rLFromB;
+ aStartLFromBR = aLFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndRFromTL = aRFromTL;
+ pEndRFromT = &rRFromT;
+ pEndRFromR = &rRFromR;
+ pEndRFromB = &rRFromB;
+ aEndRFromBL = aRFromBL;
+ }
+
+ // draw last frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ pProcessor->process( CreateBorderPrimitives( aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor ) );
+ }
+
+ // *** vertical frame borders ***
+ for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol )
+ {
+ double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow );
+ double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow );
+
+ // *Start*** variables store the data of the top end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) );
+ const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow );
+ DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow );
+ const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 );
+ const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow );
+ DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle );
+
+ // *End*** variables store the data of the bottom end of the cached frame border
+ DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow );
+ const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 );
+ const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow );
+ DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle );
+
+ for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow )
+ {
+ fAngle = mxImpl->GetVerDiagAngle( nCol, nRow );
+ fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow );
+
+ const Style& rCurr = *pEndBFromB;
+
+ DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle );
+ const Style& rTFromL = *pEndBFromL;
+ const Style& rTFromT = *pStart;
+ const Style& rTFromR = *pEndBFromR;
+ DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle );
+ const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow );
+ const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 );
+ const Style& rBFromR = GetCellStyleBottom( nCol, nRow );
+ DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndBFromTL, rTFromL, aTFromBL, aEndBFromTR, rTFromR, aTFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ pProcessor->process( CreateBorderPrimitives( aEndPos, aStartPos, *pStart,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR, pForceColor ) );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartTFromBL = aTFromBL;
+ pStartTFromL = &rTFromL;
+ pStartTFromT = &rTFromT;
+ pStartTFromR = &rTFromR;
+ aStartTFromBR = aTFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndBFromTL = aBFromTL;
+ pEndBFromL = &rBFromL;
+ pEndBFromB = &rBFromB;
+ pEndBFromR = &rBFromR;
+ aEndBFromTR = aBFromTR;
+ }
+
+ // draw last frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ pProcessor->process( CreateBorderPrimitives( aEndPos, aStartPos, *pStart,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR, pForceColor ) );
+ }
+}
void Array::DrawRange( OutputDevice& rDev,
size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow,
const Color* pForceColor ) const
commit 3800c9d28cd42348dcc194b39d87af8e36b752ef
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Thu Feb 17 23:08:53 2011 +0100
Fixed RTF import/export of new border lines
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index ed9f292..8fe68c9 100755
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -202,7 +202,7 @@ public:
bool HasPriority( const SvxBorderLine& rOtherLine ) const;
- bool isEmpty() const { return m_aWidthImpl.IsEmpty( ); }
+ bool isEmpty() const { return m_aWidthImpl.IsEmpty( ) || m_nStyle == NO_STYLE || m_nWidth == 0; }
bool isDouble() const { return m_aWidthImpl.IsDouble(); }
sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 85ee6b9..5fcfd09 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1549,265 +1549,6 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
// TODO unhandled ATM
break;
-#if 0
- case RTF_BOX:
- case RTF_BRDRT:
- case RTF_BRDRB:
- case RTF_BRDRL:
- case RTF_BRDRR:
- nBorderTyp = nToken;
- goto SETBORDER;
-
- case RTF_CLBRDRT:
- if( !bTableDef )
- break;
- nBorderTyp = RTF_BRDRT;
- goto SETBORDER;
- case RTF_CLBRDRB:
- if( !bTableDef )
- break;
- nBorderTyp = RTF_BRDRB;
- goto SETBORDER;
- case RTF_CLBRDRL:
- if( !bTableDef )
- break;
- nBorderTyp = RTF_BRDRL;
- goto SETBORDER;
- case RTF_CLBRDRR:
- if( !bTableDef )
- break;
- nBorderTyp = RTF_BRDRR;
- goto SETBORDER;
-
-SETBORDER:
- {
- // Define the default values
- aBrd.SetLinesWidths( SOLID, 0, 0, DEF_LINE_WIDTH_0 );
- aBrd.SetColor( Color( COL_BLACK ) );
- }
- break;
-
-
-// yet to be evaluated
- case RTF_BRSP:
- {
- switch( nBorderTyp )
- {
- case RTF_BRDRB:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_BOTTOM );
- break;
-
- case RTF_BRDRT:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_TOP );
- break;
-
- case RTF_BRDRL:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_LEFT );
- break;
-
- case RTF_BRDRR:
- aAttr.SetDistance( (sal_uInt16)nTokenValue, BOX_LINE_RIGHT );
- break;
-
- case RTF_BOX:
- aAttr.SetDistance( (sal_uInt16)nTokenValue );
- break;
- }
- }
- break;
-
- case RTF_BRDRBTW:
- case RTF_BRDRBAR:
- break;
-
-
- case RTF_BRDRCF:
- {
- aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) ) );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- }
- break;
-
- case RTF_BRDRTH:
- aBrd.SetLinesWidths( SOLID, 0, 0, DEF_LINE_WIDTH_1 );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
-
- case RTF_BRDRDB:
- aBrd.SetLinesWidths( SOLID, DEF_DOUBLE_LINE0_IN,
- DEF_DOUBLE_LINE0_OUT,
- DEF_DOUBLE_LINE0_DIST );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
-
- case RTF_BRDRSH:
- // shaded box
- {
- rSet.Put( SvxShadowItem( PARDID->nShadow, (Color*) 0, 60 /*3pt*/,
- SVX_SHADOW_BOTTOMRIGHT ) );
- }
- break;
-
- case RTF_BRDRW:
- if( -1 != nTokenValue )
- {
- // It should be a "thick" line?
- if( DEF_LINE_WIDTH_0 != aBrd.GetOutWidth() )
- nTokenValue *= 2;
-
- // a double line?
- if( aBrd.GetInWidth() )
- {
- // WinWord - adapt values to StarOffice
- if( nTokenValue < DEF_LINE_WIDTH_1 - (DEF_LINE_WIDTH_1/10))
- {
- aBrd.SetLinesWidths( SOLID, DEF_DOUBLE_LINE0_IN,
- DEF_DOUBLE_LINE0_OUT,
- DEF_DOUBLE_LINE0_DIST );
- }
- else
- if( nTokenValue < DEF_LINE_WIDTH_2 - (DEF_LINE_WIDTH_2/10))
- {
- aBrd.SetLinesWidths( SOLID, DEF_DOUBLE_LINE1_IN,
- DEF_DOUBLE_LINE1_OUT,
- DEF_DOUBLE_LINE1_DIST );
- }
- else
- {
- aBrd.SetLinesWidths( SOLID, DEF_DOUBLE_LINE2_IN,
- DEF_DOUBLE_LINE2_OUT,
- DEF_DOUBLE_LINE2_DIST );
- }
- }
- else
- {
- // WinWord - adapt values to StarOffice
- if( nTokenValue < DEF_LINE_WIDTH_1 - (DEF_LINE_WIDTH_1/10))
- aBrd.SetOutWidth( DEF_LINE_WIDTH_0 );
- else
- if( nTokenValue < DEF_LINE_WIDTH_2 - (DEF_LINE_WIDTH_2/10))
- aBrd.SetOutWidth( DEF_LINE_WIDTH_1 );
- else
- if( nTokenValue < DEF_LINE_WIDTH_3 - (DEF_LINE_WIDTH_3/10))
- aBrd.SetOutWidth( DEF_LINE_WIDTH_2 );
- else
- if( nTokenValue < DEF_LINE_WIDTH_4 )
- aBrd.SetOutWidth( DEF_LINE_WIDTH_3 );
- else
- aBrd.SetOutWidth( DEF_LINE_WIDTH_4 );
- }
- }
- SetBorderLine( nBorderTyp, aAttr, aBrd );
-
- case RTF_BRDRDOT:
- aBrd.SetStyle( DOTTED );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- break;
- case RTF_BRDRDASH:
- aBrd.SetStyle( DASHED );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- break;
- case RTF_BRDRS:
- case RTF_BRDRHAIR:
- aBrd.SetStyle( SOLID );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- break;
-#endif
- case BRACELEFT:
- {
- short nSkip = 0;
- if( RTF_IGNOREFLAG != GetNextToken() )
- nSkip = -1;
- else
- {
- int bSwgControl = sal_True, bFirstToken = sal_True;
- nToken = GetNextToken();
- do {
- switch( nToken )
- {
- case RTF_BRDBOX:
- aAttr.SetDistance( sal_uInt16(nTokenValue) );
- break;
-
- case RTF_BRDRT:
- case RTF_BRDRB:
- case RTF_BRDRR:
- case RTF_BRDRL:
- {
- nBorderTyp = nToken;
- bFirstToken = sal_False;
-
- sal_uInt16 nInWidth = 0;
- sal_uInt16 nOutWidth = 0;
- sal_uInt16 nDistWidth = 0;
-
- if( RTF_BRDLINE_COL != GetNextToken() )
- {
- bSwgControl = sal_False;
- break;
- }
- aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) ));
-
- if( RTF_BRDLINE_IN != GetNextToken() )
- {
- bSwgControl = sal_False;
- break;
- }
- nInWidth = sal_uInt16( nTokenValue );
-
- if( RTF_BRDLINE_OUT != GetNextToken() )
- {
- bSwgControl = sal_False;
- break;
- }
- nOutWidth = sal_uInt16( nTokenValue );
-
- if( RTF_BRDLINE_DIST != GetNextToken() )
- {
- bSwgControl = sal_False;
- break;
- }
- nDistWidth = sal_uInt16( nTokenValue );
-
- aBrd.GuessLinesWidths( NO_STYLE, nOutWidth,
- nInWidth, nDistWidth );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
- break;
- }
-
- default:
- bSwgControl = sal_False;
- break;
- }
-
- if( bSwgControl )
- {
- nToken = GetNextToken();
- bFirstToken = sal_False;
- }
- } while( bSwgControl );
-
- // End of the Swg-Group
- // -> still read the closing parenthesis
- if( BRACERIGHT == nToken )
- ;
- else if( !bFirstToken )
- {
- // It is a parser error, jump to the end of the group
- SkipGroup();
- // Disregard closing BRACERIGHT
- GetNextToken();
- }
- else
- nSkip = -2;
- }
-
- if( nSkip )
- {
- SkipToken( nSkip ); // Ignore back again
- bWeiter = sal_False;
- }
- }
- break;
-
default:
bWeiter = (nToken & ~(0xff| RTF_SWGDEFS)) == RTF_BRDRDEF;
}
commit c33c7f136fe14472c58a56211afbe96166625073
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list