diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-02-22 15:18:16 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 17:57:19 +0100 |
commit | e3aeec6664273abc7917280032c3219d8672465f (patch) | |
tree | 2b270fbd90f7f13356565e10672eb816f48a6367 | |
parent | c0c2e9ed18b29c109ef1194e9b7b4fb48fa5f787 (diff) |
svx::frame::DrawRange has now a drawinglayer equivalent
-rwxr-xr-x | drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 4 | ||||
-rw-r--r-- | drawinglayer/inc/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx | 80 | ||||
-rwxr-xr-x | drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 1 | ||||
-rwxr-xr-x | drawinglayer/prj/d.lst | 1 | ||||
-rwxr-xr-x | drawinglayer/source/primitive2d/borderlineprimitive2d.cxx | 2 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx | 81 | ||||
-rwxr-xr-x | drawinglayer/source/primitive2d/makefile.mk | 1 | ||||
-rwxr-xr-x | svx/inc/svx/framelink.hxx | 66 | ||||
-rwxr-xr-x | svx/inc/svx/framelinkarray.hxx | 8 | ||||
-rwxr-xr-x | svx/source/dialog/framelink.cxx | 88 | ||||
-rwxr-xr-x | svx/source/dialog/framelinkarray.cxx | 203 |
11 files changed, 506 insertions, 29 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 12cdbbe21009..6080881cbb42 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 000000000000..bae79087a7a8 --- /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@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 a86f82d84898..c90546148b9b 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 54f087d317e4..375889e5a12e 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 90e150c461eb..5c3a889483e8 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 000000000000..874c61746d48 --- /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@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 720769a0efd5..092612f7923f 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 6cfc8f0f7a2e..2d550d1263c4 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 32b42e8b2cfb..5b082024ca45 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 35758d713648..fa79a0aad409 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 af82d4d6695c..f6b9c9f35cd7 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 |