diff options
1989 files changed, 69773 insertions, 79367 deletions
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx index fe4bd8389d09..1e5bb36ec03d 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx @@ -53,13 +53,12 @@ class VCLXAccessibleEdit : public VCLXAccessibleTextComponent, friend class VCLXAccessibleBox; private: + sal_Int32 m_nSelectionStart; sal_Int32 m_nCaretPosition; protected: virtual ~VCLXAccessibleEdit(); - void UpdateCaretPosition(); - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk index bafd2b40c334..446ec73ec1b7 100644 --- a/accessibility/source/extended/makefile.mk +++ b/accessibility/source/extended/makefile.mk @@ -37,6 +37,9 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk # --- Files -------------------------------------------------------- +.IF "$(OS)$(COM)"=="SOLARISI" +NOOPTFILES=$(SLO)$/accessibletabbarpagelist.obj +.ENDIF # "$(OS)$(COM)"=="SOLARISI" SLOFILES=\ $(SLO)$/AccessibleBrowseBoxCheckBoxCell.obj \ diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 8fe463d00c05..50d3ac682377 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -395,7 +395,7 @@ inline bool hasFloatingChild(Window *pWindow) else xContext = new FloatingWindowAccessible( _pXWindow ); } - else if ( nType == WINDOW_HELPTEXTWINDOW ) + else if ( ( nType == WINDOW_HELPTEXTWINDOW ) || ( nType == WINDOW_FIXEDLINE ) ) { xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleFixedText( _pXWindow ); } diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 0dd8376580ec..07378c0ea42f 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -67,6 +67,7 @@ using namespace ::comphelper; VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow ) :VCLXAccessibleTextComponent( pVCLWindow ) { + m_nSelectionStart = getSelectionStart(); m_nCaretPosition = getCaretPosition(); } @@ -78,22 +79,6 @@ VCLXAccessibleEdit::~VCLXAccessibleEdit() // ----------------------------------------------------------------------------- -void VCLXAccessibleEdit::UpdateCaretPosition() -{ - sal_Int32 nCaretPosition = getCaretPosition(); - - if ( m_nCaretPosition != nCaretPosition ) - { - Any aOldValue, aNewValue; - aOldValue <<= (sal_Int32) m_nCaretPosition; - aNewValue <<= (sal_Int32) nCaretPosition; - m_nCaretPosition = nCaretPosition; - NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { switch ( rVclWindowEvent.GetId() ) @@ -105,11 +90,31 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve break; case VCLEVENT_EDIT_SELECTIONCHANGED: { + sal_Int32 nOldCaretPosition = m_nCaretPosition; + sal_Int32 nOldSelectionStart = m_nSelectionStart; + + m_nCaretPosition = getCaretPosition(); + m_nSelectionStart = getSelectionStart(); + Window* pWindow = GetWindow(); if ( pWindow && pWindow->HasChildPathFocus() ) { - NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); - UpdateCaretPosition(); + if ( m_nCaretPosition != nOldCaretPosition ) + { + Any aOldValue, aNewValue; + aOldValue <<= (sal_Int32) nOldCaretPosition; + aNewValue <<= (sal_Int32) m_nCaretPosition; + NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); + } + + // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED + sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition ); + sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition ); + if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) ) + { + NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); + } + } } break; @@ -305,22 +310,13 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBin sal_Int32 VCLXAccessibleEdit::getCaretPosition( ) throw (RuntimeException) { - OExternalLockGuard aGuard( this ); - - awt::Selection aSelection; - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - if ( pVCLXEdit ) - aSelection = pVCLXEdit->getSelection(); - - return aSelection.Max; + return getSelectionEnd(); } // ----------------------------------------------------------------------------- sal_Bool VCLXAccessibleEdit::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - return setSelection( nIndex, nIndex ); } diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index e56dcda81a9f..cdf4c58015ba 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -35,6 +35,7 @@ #define GLOBALOVERFLOW2 #include <sfx2/docfac.hxx> +#include <sfx2/sfxmodelfactory.hxx> #include <vcl/status.hxx> #include <svx/xmlsecctrl.hxx> @@ -57,12 +58,12 @@ SFX_IMPL_INTERFACE( BasicDocShell, SfxObjectShell, IDEResId( 0 ) ) SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR ) ); } -BasicDocShell::BasicDocShell( SfxObjectCreateMode eMode ) : SfxObjectShell( eMode ) +BasicDocShell::BasicDocShell() + :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) { pPrinter = 0; SetPool( &SFX_APP()->GetPool() ); - SetHasNoBasic(); - SetModel( new SIDEModel(this) ); + SetBaseModel( new SIDEModel(this) ); } __EXPORT BasicDocShell::~BasicDocShell() diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx index e1832a27521a..1ef5991cfab4 100644 --- a/basctl/source/basicide/basdoc.hxx +++ b/basctl/source/basicide/basdoc.hxx @@ -56,7 +56,7 @@ public: using SotObject::GetInterface; SFX_DECL_OBJECTFACTORY(); SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_DOCSH ) - BasicDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); + BasicDocShell(); ~BasicDocShell(); SfxPrinter* GetPrinter( BOOL bCreate ); diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 909a28543fae..4432de9aa282 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -299,10 +299,10 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) { // get statusindicator SfxViewFrame *pFrame_ = GetFrame(); - if ( pFrame_ && pFrame_->GetFrame() ) + if ( pFrame_ ) { uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame_->GetFrame()->GetFrameInterface(), + pFrame_->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if( xStatFactory.is() ) xStatusIndicator = xStatFactory->createStatusIndicator(); @@ -1153,7 +1153,7 @@ void BasicIDEShell::ManageToolbars() return; Reference< beans::XPropertySet > xFrameProps - ( GetViewFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xFrameProps.is() ) { Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 2c3ccc4eb678..23978f4df10b 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -104,7 +104,7 @@ SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) -#define IDE_VIEWSHELL_FLAGS SFX_VIEW_MAXIMIZE_FIRST|SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW +#define IDE_VIEWSHELL_FLAGS SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW // Hack for #101048 diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 996a4e772be1..95c27c65acdb 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -77,7 +77,7 @@ void LocalizationMgr::handleTranslationbar( void ) ::rtl::OUString::createFromAscii( "private:resource/toolbar/translationbar" ); Reference< beans::XPropertySet > xFrameProps - ( m_pIDEShell->GetViewFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + ( m_pIDEShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xFrameProps.is() ) { Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; diff --git a/basctl/source/basicide/makefile.mk b/basctl/source/basicide/makefile.mk index 70681b50f35a..6a08349b0979 100644 --- a/basctl/source/basicide/makefile.mk +++ b/basctl/source/basicide/makefile.mk @@ -66,6 +66,7 @@ EXCEPTIONSFILES=$(SLO)$/basicrenderable.obj \ $(SLO)$/moduldl2.obj \ $(SLO)$/unomodel.obj \ $(SLO)$/register.obj \ + $(SLO)$/basdoc.obj \ $(SLO)$/tbxctl.obj \ $(SLO)$/basidectrlr.obj \ $(SLO)$/localizationmgr.obj \ @@ -74,7 +75,6 @@ EXCEPTIONSFILES=$(SLO)$/basicrenderable.obj \ $(SLO)$/documentenumeration.obj SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/basdoc.obj \ $(SLO)$/basicbox.obj \ $(SLO)$/baside2b.obj \ $(SLO)$/brkdlg.obj \ diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx index b973adb8650b..0a4cdfcffdaa 100644 --- a/basegfx/inc/basegfx/numeric/ftools.hxx +++ b/basegfx/inc/basegfx/numeric/ftools.hxx @@ -175,7 +175,7 @@ namespace basegfx static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) { - return (fabs(rfValA) - fabs(rfValB) <= rfSmallValue); + return (fabs(rfValA - rfValB) <= rfSmallValue); } static bool less(const double& rfValA, const double& rfValB) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx index 538baa89aa81..a9d6e0a1b6fe 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx @@ -65,6 +65,14 @@ namespace basegfx B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask); B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rMask); + // look for self-intersections in given polygon and add extra points there. Result will have no + // intersections on an edge + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate); + + // add points at all self-intersections of single polygons (depends on bSelfIntersections) + // and at polygon-polygon intersections + B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true); + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index bea0de5c98d6..7d1d0bc9660c 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -271,6 +271,10 @@ namespace basegfx */ B2DPolygon createPolygonFromRect( const B2DRectangle& rRect ); + /** Create the unit polygon + */ + B2DPolygon createUnitPolygon(); + /** Create a circle polygon with given radius. This method creates a circle approximation consisting of diff --git a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx new file mode 100644 index 000000000000..70ffdf2b7339 --- /dev/null +++ b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dpolygontriangulator.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BGFX_POLYGON_B2DTRAPEZOID_HXX +#define _BGFX_POLYGON_B2DTRAPEZOID_HXX + +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <vector> + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + // class to hold a single trapezoid + class B2DTrapezoid + { + private: + // Geometry data. YValues are down-oriented, this means bottom should + // be bigger than top to be below it. The constructor implementation + // guarantees: + // + // - mfBottomY >= mfTopY + // - mfTopXRight >= mfTopXLeft + // - mfBottomXRight >= mfBottomXLeft + double mfTopXLeft; + double mfTopXRight; + double mfTopY; + double mfBottomXLeft; + double mfBottomXRight; + double mfBottomY; + + public: + // constructor + B2DTrapezoid( + const double& rfTopXLeft, + const double& rfTopXRight, + const double& rfTopY, + const double& rfBottomXLeft, + const double& rfBottomXRight, + const double& rfBottomY); + + // data read access + const double& getTopXLeft() const { return mfTopXLeft; } + const double& getTopXRight() const { return mfTopXRight; } + const double& getTopY() const { return mfTopY; } + const double& getBottomXLeft() const { return mfBottomXLeft; } + const double& getBottomXRight() const { return mfBottomXRight; } + const double& getBottomY() const { return mfBottomY; } + + // convenience method to get content as Polygon + B2DPolygon getB2DPolygon() const; + }; + + typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector; + +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to + // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves, + // it's default AdaptiveSubdivision will be used. + // CAUTION: Trapezoids are oreintation-dependent in the sense that the upper and lower + // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable + // for primitive decompositions. To use it, the shear and rotate parts of the + // involved transformations HAVE to be taken into account. + void trapezoidSubdivide( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rSourcePolyPolygon); + + // directly create trapezoids from given edge. Depending on the given geometry, + // none up to three trapezoids will be created + void createLineTrapezoidFromEdge( + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, + double fLineWidth = 1.0); + + // create trapezoids for all edges of the given polygon. The closed state of + // the polygon is taken into account. If curves are contaned, the default + // AdaptiveSubdivision will be used. + void createLineTrapezoidFromB2DPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolygon& rPolygon, + double fLineWidth = 1.0); + + // create trapezoids for all edges of the given polyPolygon. The closed state of + // the PolyPolygon is taken into account. If curves are contaned, the default + // AdaptiveSubdivision will be used. + void createLineTrapezoidFromB2DPolyPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rPolyPolygon, + double fLineWidth = 1.0); + + } // end of namespace tools +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +#endif /* _BGFX_POLYGON_B2DTRAPEZOID_HXX */ diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index e0e2438307e4..71dd227ac736 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx @@ -155,15 +155,17 @@ namespace basegfx bool equal(const B2DTuple& rTup) const { return ( - fTools::equal(mfX, rTup.mfX) && - fTools::equal(mfY, rTup.mfY)); + this == &rTup || + (fTools::equal(mfX, rTup.mfX) && + fTools::equal(mfY, rTup.mfY))); } bool equal(const B2DTuple& rTup, const double& rfSmallValue) const { return ( - fTools::equal(mfX, rTup.mfX, rfSmallValue) && - fTools::equal(mfY, rTup.mfY, rfSmallValue)); + this == &rTup || + (fTools::equal(mfX, rTup.mfX, rfSmallValue) && + fTools::equal(mfY, rTup.mfY, rfSmallValue))); } // operators diff --git a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx b/basegfx/inc/basegfx/tuple/b2i64tuple.hxx index 1bd81dc0e374..9c813c07a994 100644 --- a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2i64tuple.hxx @@ -182,7 +182,7 @@ namespace basegfx bool operator==( const B2I64Tuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } bool operator!=( const B2I64Tuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b2ituple.hxx b/basegfx/inc/basegfx/tuple/b2ituple.hxx index 9fa6e7119ee7..da29b5509dec 100644 --- a/basegfx/inc/basegfx/tuple/b2ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b2ituple.hxx @@ -181,7 +181,7 @@ namespace basegfx bool operator==( const B2ITuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } bool operator!=( const B2ITuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx index 6ad063d124a0..11fb797ff0ff 100644 --- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx @@ -179,17 +179,19 @@ namespace basegfx bool equal(const B3DTuple& rTup) const { return ( - ::basegfx::fTools::equal(mfX, rTup.mfX) && + this == &rTup || + (::basegfx::fTools::equal(mfX, rTup.mfX) && ::basegfx::fTools::equal(mfY, rTup.mfY) && - ::basegfx::fTools::equal(mfZ, rTup.mfZ)); + ::basegfx::fTools::equal(mfZ, rTup.mfZ))); } bool equal(const B3DTuple& rTup, const double& rfSmallValue) const { return ( - ::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && + this == &rTup || + (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) && - ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue)); + ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue))); } // operators diff --git a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx b/basegfx/inc/basegfx/tuple/b3i64tuple.hxx index 13a7cb87ace3..a2d754fe4f79 100644 --- a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3i64tuple.hxx @@ -212,7 +212,7 @@ namespace basegfx bool operator==( const B3I64Tuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } bool operator!=( const B3I64Tuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b3ituple.hxx b/basegfx/inc/basegfx/tuple/b3ituple.hxx index 4df462bf3f22..644ae07b6545 100644 --- a/basegfx/inc/basegfx/tuple/b3ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b3ituple.hxx @@ -212,7 +212,7 @@ namespace basegfx bool operator==( const B3ITuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } bool operator!=( const B3ITuple& rTup ) const diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index a58cd33e4f9c..68ab880eef62 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -73,6 +73,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\polygon ..\inc\basegfx\polygon\b2dpolygontriangulator.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolygontriangulator.hxx ..\inc\basegfx\polygon\b2dpolygoncutandtouch.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolygoncutandtouch.hxx ..\inc\basegfx\polygon\b2dpolypolygoncutter.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolypolygoncutter.hxx +..\inc\basegfx\polygon\b2dtrapezoid.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dtrapezoid.hxx ..\inc\basegfx\polygon\b3dpolygon.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolygon.hxx ..\inc\basegfx\polygon\b3dpolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolypolygon.hxx ..\inc\basegfx\polygon\b3dpolygontools.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolygontools.hxx diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 9eab4b26c8b3..11955ceb22f9 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -1200,6 +1200,96 @@ namespace basegfx return aRetval; } + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate) + { + if(rCandidate.count()) + { + temporaryPointVector aTempPoints; + + findCuts(rCandidate, aTempPoints); + + return mergeTemporaryPointsAndPolygon(rCandidate, aTempPoints); + } + else + { + return rCandidate; + } + } + + B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, bool bSelfIntersections) + { + const sal_uInt32 nCount(rCandidate.count()); + + if(nCount) + { + B2DPolyPolygon aRetval; + + if(1 == nCount) + { + if(bSelfIntersections) + { + // remove self intersections + aRetval.append(addPointsAtCuts(rCandidate.getB2DPolygon(0))); + } + else + { + // copy source + aRetval = rCandidate; + } + } + else + { + // first solve self cuts for all contained single polygons + temporaryPolygonData *pTempData = new temporaryPolygonData[nCount]; + sal_uInt32 a, b; + + for(a = 0; a < nCount; a++) + { + if(bSelfIntersections) + { + // use polygons with solved self intersections + pTempData[a].setPolygon(addPointsAtCuts(rCandidate.getB2DPolygon(a))); + } + else + { + // copy given polygons + pTempData[a].setPolygon(rCandidate.getB2DPolygon(a)); + } + } + + // now cuts and touches between the polygons + for(a = 0; a < nCount; a++) + { + for(b = 0; b < nCount; b++) + { + if(a < b) + { + // look for cuts, compare each edge polygon to following ones + if(pTempData[a].getRange().overlaps(pTempData[b].getRange())) + { + findCuts(pTempData[a].getPolygon(), pTempData[b].getPolygon(), pTempData[a].getTemporaryPointVector(), pTempData[b].getTemporaryPointVector()); + } + } + } + } + + // consolidate the result + for(a = 0L; a < nCount; a++) + { + aRetval.append(mergeTemporaryPointsAndPolygon(pTempData[a].getPolygon(), pTempData[a].getTemporaryPointVector())); + } + + delete[] pTempData; + } + + return aRetval; + } + else + { + return rCandidate; + } + } + //////////////////////////////////////////////////////////////////////////////// } // end of namespace tools diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 28e5bb1f430d..e54a5e2707c9 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1835,6 +1835,24 @@ namespace basegfx return aRetval; } + B2DPolygon createUnitPolygon() + { + static B2DPolygon aRetval; + + if(!aRetval.count()) + { + aRetval.append( B2DPoint( 0.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 1.0 ) ); + aRetval.append( B2DPoint( 0.0, 1.0 ) ); + + // close + aRetval.setClosed( true ); + } + + return aRetval; + } + B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius ) { return createPolygonFromEllipse( rCenter, fRadius, fRadius ); diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx new file mode 100644 index 000000000000..4cd63f938114 --- /dev/null +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -0,0 +1,1227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dpolygontriangulator.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basegfx.hxx" +#include <basegfx/polygon/b2dtrapezoid.hxx> +#include <basegfx/range/b1drange.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <list> + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace trapezoidhelper + { + ////////////////////////////////////////////////////////////////////////////// + // helper class to hold a simple ege. This is only used for horizontal edges + // currently, thus the YPositions will be equal. I did not create a special + // class for this since holdingthe pointers is more effective and also can be + // used as baseclass for the traversing edges + + class TrDeSimpleEdge + { + protected: + // pointers to start and end point + const B2DPoint* mpStart; + const B2DPoint* mpEnd; + + public: + // constructor + TrDeSimpleEdge( + const B2DPoint* pStart, + const B2DPoint* pEnd) + : mpStart(pStart), + mpEnd(pEnd) + { + } + + // data read access + const B2DPoint& getStart() const { return *mpStart; } + const B2DPoint& getEnd() const { return *mpEnd; } + }; + + ////////////////////////////////////////////////////////////////////////////// + // define vector of simple edges + + typedef ::std::vector< TrDeSimpleEdge > TrDeSimpleEdges; + + ////////////////////////////////////////////////////////////////////////////// + // helper class for holding a traversing edge. It will always have some + // distance in YPos. The slope (in a numerically useful form, see comments) is + // hold and used in SortValue to allow sorting traversing edges by Y, X and slope + // (in that order) + + class TrDeEdgeEntry : public TrDeSimpleEdge + { + private: + // the slope in a numerical useful form for sorting + sal_uInt32 mnSortValue; + + public: + // convenience data read access + double getDeltaX() const { return mpEnd->getX() - mpStart->getX(); } + double getDeltaY() const { return mpEnd->getY() - mpStart->getY(); } + + // convenience data read access. SortValue is created on demand since + // it is not always used + sal_uInt32 getSortValue() const + { + if(0 != mnSortValue) + return mnSortValue; + + // get radiant; has to be in the range ]0.0 .. pi[, thus scale to full + // sal_uInt32 range for maximum precision + const double fRadiant(atan2(getDeltaY(), getDeltaX()) * (SAL_MAX_UINT32 / F_PI)); + + // convert to sal_uInt32 value + const_cast< TrDeEdgeEntry* >(this)->mnSortValue = sal_uInt32(fRadiant); + + return mnSortValue; + } + + // constructor. SortValue can be given when known, use zero otherwise + TrDeEdgeEntry( + const B2DPoint* pStart, + const B2DPoint* pEnd, + sal_uInt32 nSortValue = 0) + : TrDeSimpleEdge(pStart, pEnd), + mnSortValue(nSortValue) + { + // force traversal of deltaY downward + if(mpEnd->getY() < mpStart->getY()) + { + std::swap(mpStart, mpEnd); + } + + // no horizontal edges allowed, all neeed to traverse vertically + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + + // data write access to StartPoint + void setStart( const B2DPoint* pNewStart) + { + OSL_ENSURE(0 != pNewStart, "No null pointer allowed here (!)"); + + if(mpStart != pNewStart) + { + mpStart = pNewStart; + + // no horizontal edges allowed, all neeed to traverse vertivally + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + } + + // data write access to EndPoint + void setEnd( const B2DPoint* pNewEnd) + { + OSL_ENSURE(0 != pNewEnd, "No null pointer allowed here (!)"); + + if(mpEnd != pNewEnd) + { + mpEnd = pNewEnd; + + // no horizontal edges allowed, all neeed to traverse vertivally + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + } + + // operator for sort support. Sort by Y, X and slope (in that order) + bool operator<(const TrDeEdgeEntry& rComp) const + { + if(fTools::equal(getStart().getY(), rComp.getStart().getY(), fTools::getSmallValue())) + { + if(fTools::equal(getStart().getX(), rComp.getStart().getX(), fTools::getSmallValue())) + { + // when start points are equal, use the direction the edge is pointing + // to. That value is created on demand and derived from atan2 in the + // range ]0.0 .. pi[ (without extremas, we always have a deltaY in this + // class) and scaled to sal_uInt32 range for best precision. 0 means no angle, + // while SAL_MAX_UINT32 means pi. Thus, the higher the value, the more left + // the edge traverses. + return (getSortValue() > rComp.getSortValue()); + } + else + { + return fTools::less(getStart().getX(), rComp.getStart().getX()); + } + } + else + { + return fTools::less(getStart().getY(), rComp.getStart().getY()); + } + } + + // method for cut support + B2DPoint getCutPointForGivenY(double fGivenY) + { + // Calculate cut point locally (do not use interpolate) since it is numerically + // necessary to guarantee the new, equal Y-coordinate + const double fFactor((fGivenY - getStart().getY()) / getDeltaY()); + const double fDeltaXNew(fFactor * getDeltaX()); + + return B2DPoint(getStart().getX() + fDeltaXNew, fGivenY); + } + }; + + ////////////////////////////////////////////////////////////////////////////// + // define double linked list of edges (for fast random insert) + + typedef ::std::list< TrDeEdgeEntry > TrDeEdgeEntries; + + } // end of anonymous namespace +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace trapezoidhelper + { + // helper class to handle the complete trapezoid subdivision of a PolyPolygon + class TrapezoidSubdivider + { + private: + // local data + sal_uInt32 mnInitialEdgeEntryCount; + TrDeEdgeEntries maTrDeEdgeEntries; + ::std::vector< B2DPoint > maPoints; + ::std::vector< B2DPoint* > maNewPoints; + + void addEdgeSorted( + TrDeEdgeEntries::iterator aCurrent, + const TrDeEdgeEntry& rNewEdge) + { + // Loop while new entry is bigger, use operator< + while(aCurrent != maTrDeEdgeEntries.end() && (*aCurrent) < rNewEdge) + { + aCurrent++; + } + + // Insert before first which is smaller or equal or at end + maTrDeEdgeEntries.insert(aCurrent, rNewEdge); + } + + bool splitEdgeAtGivenPoint( + TrDeEdgeEntries::reference aEdge, + const B2DPoint& rCutPoint, + TrDeEdgeEntries::iterator aCurrent) + { + // do not create edges without deltaY: do not split when start is identical + if(aEdge.getStart().equal(rCutPoint, fTools::getSmallValue())) + { + return false; + } + + // do not create edges without deltaY: do not split when end is identical + if(aEdge.getEnd().equal(rCutPoint, fTools::getSmallValue())) + { + return false; + } + + const double fOldDeltaYStart(rCutPoint.getY() - aEdge.getStart().getY()); + + if(fTools::lessOrEqual(fOldDeltaYStart, 0.0)) + { + // do not split: the resulting edge would be horizontal + // correct it to new start point + aEdge.setStart(&rCutPoint); + return false; + } + + const double fNewDeltaYStart(aEdge.getEnd().getY() - rCutPoint.getY()); + + if(fTools::lessOrEqual(fNewDeltaYStart, 0.0)) + { + // do not split: the resulting edge would be horizontal + // correct it to new end point + aEdge.setEnd(&rCutPoint); + return false; + } + + // Create new entry + const TrDeEdgeEntry aNewEdge( + &rCutPoint, + &aEdge.getEnd(), + aEdge.getSortValue()); + + // Correct old entry + aEdge.setEnd(&rCutPoint); + + // Insert sorted (to avoid new sort) + addEdgeSorted(aCurrent, aNewEdge); + + return true; + } + + bool testAndCorrectEdgeIntersection( + TrDeEdgeEntries::reference aEdgeA, + TrDeEdgeEntries::reference aEdgeB, + TrDeEdgeEntries::iterator aCurrent) + { + // Exclude simple cases: same start or end point + if(aEdgeA.getStart().equal(aEdgeB.getStart(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getStart().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getEnd().equal(aEdgeB.getStart(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getEnd().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + // Exclude simple cases: one of the edges has no length anymore + if(aEdgeA.getStart().equal(aEdgeA.getEnd(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeB.getStart().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + // check if one point is on the other edge (a touch, not a cut) + const B2DVector aDeltaB(aEdgeB.getDeltaX(), aEdgeB.getDeltaY()); + + if(tools::isPointOnEdge(aEdgeA.getStart(), aEdgeB.getStart(), aDeltaB)) + { + return splitEdgeAtGivenPoint(aEdgeB, aEdgeA.getStart(), aCurrent); + } + + if(tools::isPointOnEdge(aEdgeA.getEnd(), aEdgeB.getStart(), aDeltaB)) + { + return splitEdgeAtGivenPoint(aEdgeB, aEdgeA.getEnd(), aCurrent); + } + + const B2DVector aDeltaA(aEdgeA.getDeltaX(), aEdgeA.getDeltaY()); + + if(tools::isPointOnEdge(aEdgeB.getStart(), aEdgeA.getStart(), aDeltaA)) + { + return splitEdgeAtGivenPoint(aEdgeA, aEdgeB.getStart(), aCurrent); + } + + if(tools::isPointOnEdge(aEdgeB.getEnd(), aEdgeA.getStart(), aDeltaA)) + { + return splitEdgeAtGivenPoint(aEdgeA, aEdgeB.getEnd(), aCurrent); + } + + // check for cut inside edges. Use both t-values to choose the more precise + // one later + double fCutA(0.0); + double fCutB(0.0); + + if(tools::findCut( + aEdgeA.getStart(), aDeltaA, + aEdgeB.getStart(), aDeltaB, + CUTFLAG_LINE, + &fCutA, + &fCutB)) + { + // use a simple metric (length criteria) for choosing the numerically + // better cut + const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY()); + const double fSimpleLengthB(aDeltaB.getX() + aDeltaB.getY()); + const bool bAIsLonger(fSimpleLengthA > fSimpleLengthB); + B2DPoint* pNewPoint = bAIsLonger + ? new B2DPoint(aEdgeA.getStart() + (fCutA * aDeltaA)) + : new B2DPoint(aEdgeB.getStart() + (fCutB * aDeltaB)); + bool bRetval(false); + + // try to split both edges + bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent); + bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent); + + if(bRetval) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + + return bRetval; + } + + return false; + } + + void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges) + { + if(rTrDeSimpleEdges.size() && maTrDeEdgeEntries.size()) + { + // there were horizontal edges. These can be excluded, but + // cuts with other edges need to be solved and added before + // ignoring them + sal_uInt32 a(0); + + for(a = 0; a < rTrDeSimpleEdges.size(); a++) + { + // get horizontal edge as candidate; prepare it's range and fixed Y + const TrDeSimpleEdge& rHorEdge = rTrDeSimpleEdges[a]; + const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX()); + const double fFixedY(rHorEdge.getStart().getY()); + + // loop over traversing edges + TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin()); + + do + { + // get compare edge + TrDeEdgeEntries::reference aCompare(*aCurrent++); + + if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY)) + { + // edge ends above horizontal edge, continue + continue; + } + + if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY)) + { + // edge starts below horizontal edge, continue + continue; + } + + // vertical overlap, get horizontal range + const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); + + if(aRange.overlaps(aCompareRange)) + { + // possible cut, get cut point + const B2DPoint aSplit(aCompare.getCutPointForGivenY(fFixedY)); + + if(fTools::more(aSplit.getX(), aRange.getMinimum()) + && fTools::less(aSplit.getX(), aRange.getMaximum())) + { + // cut is in XRange of horizontal edge, potenitally needed cut + B2DPoint* pNewPoint = new B2DPoint(aSplit); + + if(splitEdgeAtGivenPoint(aCompare, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + } + while(aCurrent != maTrDeEdgeEntries.end() + && fTools::less(aCurrent->getStart().getY(), fFixedY)); + } + } + } + + public: + TrapezoidSubdivider( + const B2DPolyPolygon& rSourcePolyPolygon) + : mnInitialEdgeEntryCount(0), + maTrDeEdgeEntries(), + maPoints(), + maNewPoints() + { + B2DPolyPolygon aSource(rSourcePolyPolygon); + const sal_uInt32 nPolygonCount(rSourcePolyPolygon.count()); + TrDeSimpleEdges aTrDeSimpleEdges; + sal_uInt32 a(0), b(0); + sal_uInt32 nAllPointCount(0); + + // ensure there are no curves used + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + + for(a = 0; a < nPolygonCount; a++) + { + // 1st run: count points + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + nAllPointCount += nCount; + } + } + + if(nAllPointCount) + { + // reserve needed points. CAUTION: maPoints size is NOT to be changed anymore + // after 2nd loop since pointers to it are used in the edges + maPoints.reserve(nAllPointCount); + + for(a = 0; a < nPolygonCount; a++) + { + // 2nd run: add points + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + for(b = 0; b < nCount; b++) + { + maPoints.push_back(aPolygonCandidate.getB2DPoint(b)); + } + } + } + + // Moved the edge construction to a 3rd run: doing it in the 2nd run is + // possible(and i used it), but requires a working vector::reserve() + // implementation, else the vector will be reallocated and the pointers + // in the edges may be wrong. Security first here. + sal_uInt32 nStartIndex(0); + + for(a = 0; a < nPolygonCount; a++) + { + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + // get the last point of the current polygon + B2DPoint* pPrev(&maPoints[nCount + nStartIndex - 1]); + + for(b = 0; b < nCount; b++) + { + // get next point + B2DPoint* pCurr(&maPoints[nStartIndex++]); + + if(fTools::equal(pPrev->getY(), pCurr->getY(), fTools::getSmallValue())) + { + // horizontal edge, check for single point + if(!fTools::equal(pPrev->getX(), pCurr->getX(), fTools::getSmallValue())) + { + // X-order not needed, just add + aTrDeSimpleEdges.push_back(TrDeSimpleEdge(pPrev, pCurr)); + + const double fMiddle((pPrev->getY() + pCurr->getY()) * 0.5); + pPrev->setY(fMiddle); + pCurr->setY(fMiddle); + } + } + else + { + // vertical edge. Positive Y-direction is guaranteed by the + // TrDeEdgeEntry constructor + maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0)); + mnInitialEdgeEntryCount++; + } + + // prepare next step + pPrev = pCurr; + } + } + } + } + + if(maTrDeEdgeEntries.size()) + { + // single and initial sort of traversing edges + maTrDeEdgeEntries.sort(); + + // solve horizontal edges if there are any detected + solveHorizontalEdges(aTrDeSimpleEdges); + } + } + + ~TrapezoidSubdivider() + { + // delete the extra points created for cuts + const sal_uInt32 nCount(maNewPoints.size()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + delete maNewPoints[a]; + } + } + + void Subdivide(B2DTrapezoidVector& ro_Result) + { + // This is the central subdivider. The strategy is to use the first two entries + // from the traversing edges as a potential trapezoid and do the needed corrections + // and adaptions on the way. + // + // There always must be two edges with the same YStart value: When adding the polygons + // in the constructor, there is always a topmost point from which two edges start; when + // the topmost is an edge, there is a start and end of this edge from which two edges + // start. All cases have two edges with same StartY (QED). + // + // Based on this these edges get corrected when: + // - one is longer than the other + // - they intersect + // - they intersect with other edges + // - another edge starts inside the thought trapezoid + // + // All this cases again produce a valid state so that the first two edges have a common + // Ystart again. Some cases lead to a restart of the process, some allow consuming the + // edges and create the intended trapezoid. + // + // Be careful when doing chages here: It is essential to keep all possible paths + // in valid states and to be numerically correct. This is especially needed e.g. + // by using fTools::equal(..) in the more robust small-value incarnation. + B1DRange aLeftRange; + B1DRange aRightRange; + + if(!maTrDeEdgeEntries.empty()) + { + // measuring shows that the relation between edges and created trapezoids is + // mostly in the 1:1 range, thus reserve as much trapezoids as edges exist. Do + // not use maTrDeEdgeEntries.size() since that may be a non-constant time + // operation for Lists. Instead, use mnInitialEdgeEntryCount which will contain + // the roughly counted adds to the List + ro_Result.reserve(ro_Result.size() + mnInitialEdgeEntryCount); + } + + while(!maTrDeEdgeEntries.empty()) + { + // Prepare current operator and get first edge + TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin()); + TrDeEdgeEntries::reference aLeft(*aCurrent++); + + if(aCurrent == maTrDeEdgeEntries.end()) + { + // Should not happen: No 2nd edge; consume the single edge + // to not have an endless loop and start next. During development + // i constantly had breakpoints here, so i am sure enough to add an + // assertion here + OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)"); + maTrDeEdgeEntries.pop_front(); + continue; + } + + // get second edge + TrDeEdgeEntries::reference aRight(*aCurrent++); + + if(!fTools::equal(aLeft.getStart().getY(), aRight.getStart().getY(), fTools::getSmallValue())) + { + // Should not happen: We have a 2nd edge, but YStart is on another + // line; consume the single edge to not have an endless loop and start + // next. During development i constantly had breakpoints here, so i am + // sure enough to add an assertion here + OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)"); + maTrDeEdgeEntries.pop_front(); + continue; + } + + // aLeft and aRight build a thought trapezoid now. They have a common + // start line (same Y for start points). Potentially, one of the edges + // is longer than the other. It is only needed to look at the shorter + // length which build the potential trapezoid. To do so, get the end points + // locally and adapt the evtl. longer one. Use only aLeftEnd and aRightEnd + // from here on, not the aLeft.getEnd() or aRight.getEnd() accesses. + B2DPoint aLeftEnd(aLeft.getEnd()); + B2DPoint aRightEnd(aRight.getEnd()); + + // check if end points are on the same line. If yes, no adaption + // needs to be prepared. Also remember which one actually is longer. + const bool bEndOnSameLine(fTools::equal(aLeftEnd.getY(), aRightEnd.getY(), fTools::getSmallValue())); + bool bLeftIsLonger(false); + + if(!bEndOnSameLine) + { + // check which edge is longer and correct accordingly + bLeftIsLonger = fTools::more(aLeftEnd.getY(), aRightEnd.getY()); + + if(bLeftIsLonger) + { + aLeftEnd = aLeft.getCutPointForGivenY(aRightEnd.getY()); + } + else + { + aRightEnd = aRight.getCutPointForGivenY(aLeftEnd.getY()); + } + } + + // check for same start and end points + const bool bSameStartPoint(aLeft.getStart().equal(aRight.getStart(), fTools::getSmallValue())); + const bool bSameEndPoint(aLeftEnd.equal(aRightEnd, fTools::getSmallValue())); + + // check the simple case that the edges form a 'blind' edge (deadend) + if(bSameStartPoint && bSameEndPoint) + { + // correct the longer edge if prepared + if(!bEndOnSameLine) + { + if(bLeftIsLonger) + { + B2DPoint* pNewPoint = new B2DPoint(aLeftEnd); + + if(splitEdgeAtGivenPoint(aLeft, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + else + { + B2DPoint* pNewPoint = new B2DPoint(aRightEnd); + + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + + // consume both edges and start next run + maTrDeEdgeEntries.pop_front(); + maTrDeEdgeEntries.pop_front(); + + continue; + } + + // check if the edges self-intersect. This can only happen when + // start and end point are different + bool bRangesSet(false); + + if(!(bSameStartPoint || bSameEndPoint)) + { + // get XRanges of edges + aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); + aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); + bRangesSet = true; + + // use fast range test first + if(aLeftRange.overlaps(aRightRange)) + { + // real cut test and correction. If correction was needed, + // start new run + if(testAndCorrectEdgeIntersection(aLeft, aRight, aCurrent)) + { + continue; + } + } + } + + // now we need to check if there are intersections with other edges + // or if other edges start inside the candidate trapezoid + if(aCurrent != maTrDeEdgeEntries.end() + && fTools::less(aCurrent->getStart().getY(), aLeftEnd.getY())) + { + // get XRanges of edges + if(!bRangesSet) + { + aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); + aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); + } + + // build full XRange for fast check + B1DRange aAllRange(aLeftRange); + aAllRange.expand(aRightRange); + + // prepare loop iterator; aCurrent needs to stay unchanged for + // eventual sorted insertions of new EdgeNodes. Also prepare stop flag + TrDeEdgeEntries::iterator aLoop(aCurrent); + bool bDone(false); + + do + { + // get compare edge and it's XRange + TrDeEdgeEntries::reference aCompare(*aLoop++); + + // avoid edges using the same start point as one of + // the edges. These can neither have their start point + // in the thought trapezoid nor cut with one of the edges + if(aCompare.getStart().equal(aRight.getStart(), fTools::getSmallValue())) + { + continue; + } + + // get compare XRange + const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); + + // use fast range test first + if(aAllRange.overlaps(aCompareRange)) + { + // check for start point inside thought trapezoid + if(fTools::more(aCompare.getStart().getY(), aLeft.getStart().getY())) + { + // calculate the two possible split points at compare's Y + const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aCompare.getStart().getY())); + const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aCompare.getStart().getY())); + + // check for start point of aCompare being inside thought + // trapezoid + if(aCompare.getStart().getX() >= aSplitLeft.getX() && + aCompare.getStart().getX() <= aSplitRight.getX()) + { + // is inside, correct and restart loop + B2DPoint* pNewLeft = new B2DPoint(aSplitLeft); + + if(splitEdgeAtGivenPoint(aLeft, *pNewLeft, aCurrent)) + { + maNewPoints.push_back(pNewLeft); + } + else + { + delete pNewLeft; + } + + B2DPoint* pNewRight = new B2DPoint(aSplitRight); + + if(splitEdgeAtGivenPoint(aRight, *pNewRight, aCurrent)) + { + maNewPoints.push_back(pNewRight); + } + else + { + delete pNewRight; + } + + bDone = true; + } + } + + if(!bDone && aLeftRange.overlaps(aCompareRange)) + { + // test for concrete cut of compare edge with left edge + bDone = testAndCorrectEdgeIntersection(aLeft, aCompare, aCurrent); + } + + if(!bDone && aRightRange.overlaps(aCompareRange)) + { + // test for concrete cut of compare edge with Right edge + bDone = testAndCorrectEdgeIntersection(aRight, aCompare, aCurrent); + } + } + } + while(!bDone + && aLoop != maTrDeEdgeEntries.end() + && fTools::less(aLoop->getStart().getY(), aLeftEnd.getY())); + + if(bDone) + { + // something needed to be changed; start next loop + continue; + } + } + + // when we get here, the intended trapezoid can be used. It needs to + // be corrected, eventually (if prepared); but this is no reason not to + // use it in the same loop iteration + if(!bEndOnSameLine) + { + if(bLeftIsLonger) + { + B2DPoint* pNewPoint = new B2DPoint(aLeftEnd); + + if(splitEdgeAtGivenPoint(aLeft, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + else + { + B2DPoint* pNewPoint = new B2DPoint(aRightEnd); + + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + + // the two edges start at the same Y, they use the same DeltaY, they + // do not cut themselves and not any other edge in range. Create a + // B2DTrapezoid and consume both edges + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeftEnd.getX(), + aRightEnd.getX(), + aLeftEnd.getY())); + + maTrDeEdgeEntries.pop_front(); + maTrDeEdgeEntries.pop_front(); + } + } + }; + } // end of anonymous namespace +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + B2DTrapezoid::B2DTrapezoid( + const double& rfTopXLeft, + const double& rfTopXRight, + const double& rfTopY, + const double& rfBottomXLeft, + const double& rfBottomXRight, + const double& rfBottomY) + : mfTopXLeft(rfTopXLeft), + mfTopXRight(rfTopXRight), + mfTopY(rfTopY), + mfBottomXLeft(rfBottomXLeft), + mfBottomXRight(rfBottomXRight), + mfBottomY(rfBottomY) + { + // guarantee mfTopXRight >= mfTopXLeft + if(mfTopXLeft > mfTopXRight) + { + std::swap(mfTopXLeft, mfTopXRight); + } + + // guarantee mfBottomXRight >= mfBottomXLeft + if(mfBottomXLeft > mfBottomXRight) + { + std::swap(mfBottomXLeft, mfBottomXRight); + } + + // guarantee mfBottomY >= mfTopY + if(mfTopY > mfBottomY) + { + std::swap(mfTopY, mfBottomY); + std::swap(mfTopXLeft, mfBottomXLeft); + std::swap(mfTopXRight, mfBottomXRight); + } + } + + B2DPolygon B2DTrapezoid::getB2DPolygon() const + { + B2DPolygon aRetval; + + aRetval.append(B2DPoint(getTopXLeft(), getTopY())); + aRetval.append(B2DPoint(getTopXRight(), getTopY())); + aRetval.append(B2DPoint(getBottomXRight(), getBottomY())); + aRetval.append(B2DPoint(getBottomXLeft(), getBottomY())); + aRetval.setClosed(true); + + return aRetval; + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + // convert Source PolyPolygon to trapezoids + void trapezoidSubdivide(B2DTrapezoidVector& ro_Result, const B2DPolyPolygon& rSourcePolyPolygon) + { + trapezoidhelper::TrapezoidSubdivider aTrapezoidSubdivider(rSourcePolyPolygon); + + aTrapezoidSubdivider.Subdivide(ro_Result); + } + + void createLineTrapezoidFromEdge( + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, + double fLineWidth) + { + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + // no line witdh + return; + } + + if(rPointA.equal(rPointB, fTools::getSmallValue())) + { + // points are equal, no edge + return; + } + + const double fHalfLineWidth(0.5 * fLineWidth); + + if(fTools::equal(rPointA.getX(), rPointB.getX(), fTools::getSmallValue())) + { + // vertical line + const double fLeftX(rPointA.getX() - fHalfLineWidth); + const double fRightX(rPointA.getX() + fHalfLineWidth); + + ro_Result.push_back( + B2DTrapezoid( + fLeftX, + fRightX, + std::min(rPointA.getY(), rPointB.getY()), + fLeftX, + fRightX, + std::max(rPointA.getY(), rPointB.getY()))); + } + else if(fTools::equal(rPointA.getY(), rPointB.getY(), fTools::getSmallValue())) + { + // horizontal line + const double fLeftX(std::min(rPointA.getX(), rPointB.getX())); + const double fRightX(std::max(rPointA.getX(), rPointB.getX())); + + ro_Result.push_back( + B2DTrapezoid( + fLeftX, + fRightX, + rPointA.getY() - fHalfLineWidth, + fLeftX, + fRightX, + rPointA.getY() + fHalfLineWidth)); + } + else + { + // diagonal line + // create perpendicular vector + const B2DVector aDelta(rPointB - rPointA); + B2DVector aPerpendicular(-aDelta.getY(), aDelta.getX()); + aPerpendicular.setLength(fHalfLineWidth); + + // create StartLow, StartHigh, EndLow and EndHigh + const B2DPoint aStartLow(rPointA + aPerpendicular); + const B2DPoint aStartHigh(rPointA - aPerpendicular); + const B2DPoint aEndHigh(rPointB - aPerpendicular); + const B2DPoint aEndLow(rPointB + aPerpendicular); + + // create EdgeEntries + basegfx::trapezoidhelper::TrDeEdgeEntries aTrDeEdgeEntries; + + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartLow, &aStartHigh, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartHigh, &aEndHigh, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndHigh, &aEndLow, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndLow, &aStartLow, 0)); + aTrDeEdgeEntries.sort(); + + // here we know we have exactly four edges, and they do not cut, touch or + // intersect. This makes processing much easier. Get the first two as start + // edges for the thought trapezoid + basegfx::trapezoidhelper::TrDeEdgeEntries::iterator aCurrent(aTrDeEdgeEntries.begin()); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight(*aCurrent++); + const bool bEndOnSameLine(fTools::equal(aLeft.getEnd().getY(), aRight.getEnd().getY(), fTools::getSmallValue())); + + if(bEndOnSameLine) + { + // create two triangle trapezoids + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeft.getEnd().getX(), + aRight.getEnd().getX(), + aLeft.getEnd().getY())); + + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + + ro_Result.push_back( + B2DTrapezoid( + aLeft2.getStart().getX(), + aRight2.getStart().getX(), + aLeft2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + else + { + // create three trapezoids. Check which edge is longer and + // correct accordingly + const bool bLeftIsLonger(fTools::more(aLeft.getEnd().getY(), aRight.getEnd().getY())); + + if(bLeftIsLonger) + { + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aRight.getEnd().getY())); + const B2DPoint aSplitRight(aRight2.getCutPointForGivenY(aLeft.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight.getEnd().getY(), + aLeft2.getStart().getX(), + aSplitRight.getX(), + aLeft2.getStart().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft2.getStart().getX(), + aSplitRight.getX(), + aLeft2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + else + { + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aLeft.getEnd().getY())); + const B2DPoint aSplitLeft(aLeft2.getCutPointForGivenY(aRight.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeft.getEnd().getX(), + aSplitRight.getX(), + aLeft.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getEnd().getX(), + aSplitRight.getX(), + aLeft.getEnd().getY(), + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight2.getStart().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + } + } + } + + void createLineTrapezoidFromB2DPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolygon& rPolygon, + double fLineWidth) + { + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + return; + } + + // ensure there are no curves used + B2DPolygon aSource(rPolygon); + + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + + const sal_uInt32 nPointCount(aSource.count()); + + if(!nPointCount) + { + return; + } + + const sal_uInt32 nEdgeCount(aSource.isClosed() ? nPointCount : nPointCount - 1); + B2DPoint aCurrent(aSource.getB2DPoint(0)); + + ro_Result.reserve(ro_Result.size() + (3 * nEdgeCount)); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + const B2DPoint aNext(aSource.getB2DPoint(nNextIndex)); + + createLineTrapezoidFromEdge(ro_Result, aCurrent, aNext, fLineWidth); + aCurrent = aNext; + } + } + + void createLineTrapezoidFromB2DPolyPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rPolyPolygon, + double fLineWidth) + { + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + return; + } + + // ensure there are no curves used + B2DPolyPolygon aSource(rPolyPolygon); + + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + + const sal_uInt32 nCount(aSource.count()); + + if(!nCount) + { + return; + } + + for(sal_uInt32 a(0); a < nCount; a++) + { + createLineTrapezoidFromB2DPolygon( + ro_Result, + aSource.getB2DPolygon(a), + fLineWidth); + } + } + + } // end of namespace tools +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/basegfx/source/polygon/makefile.mk b/basegfx/source/polygon/makefile.mk index aeb0af6c5d1b..7ac71ada5e8e 100644 --- a/basegfx/source/polygon/makefile.mk +++ b/basegfx/source/polygon/makefile.mk @@ -51,6 +51,7 @@ SLOFILES= \ $(SLO)$/b2dpolygonclipper.obj \ $(SLO)$/b2dpolygontriangulator.obj \ $(SLO)$/b2dpolygoncutandtouch.obj \ + $(SLO)$/b2dtrapezoid.obj \ $(SLO)$/b3dpolygon.obj \ $(SLO)$/b3dpolygontools.obj \ $(SLO)$/b3dpolypolygon.obj \ diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 6ccb7e81d2c4..14c84420dad6 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1744,7 +1744,7 @@ void SfxLibraryContainer::implImportLibDescriptor // Methods of new XLibraryStorage interface? -void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete ) +void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, sal_Bool bComplete ) { const Sequence< OUString > aNames = maNameContainer.getElementNames(); sal_Int32 nNameCount = aNames.getLength(); @@ -1765,35 +1765,13 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave ); // Write to storage? - sal_Bool bStorage = xStorage.is(); - uno::Reference< embed::XStorage > xLibrariesStor; + sal_Bool bStorage = i_rStorage.is(); uno::Reference< embed::XStorage > xSourceLibrariesStor; - if( bStorage ) + uno::Reference< embed::XStorage > xTargetLibrariesStor; + ::rtl::OUString sTempTargetStorName; + const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage ); + if ( bStorage ) { - // when we save to our root storage, ensure the libs are all loaded. Else the below cleaning - // of the target storage will loose them. - if ( xStorage == mxStorage ) - { - pName = aNames.getConstArray(); - for ( ; pName != pNamesEnd; ++pName ) - { - if ( !isLibraryLoaded( *pName ) ) - loadLibrary( *pName ); - } - } - - // first of all, clean the target library storage, since the storing procedure must do overwrite - try - { - if ( xStorage->hasByName( maLibrariesDir ) ) - xStorage->removeElement( maLibrariesDir ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } - // Don't write if only empty standard lib exists if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) ) { @@ -1804,29 +1782,54 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto return; } - try { - xLibrariesStor.set( xStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); + // create the empty target storage + try + { + ::rtl::OUString sTargetLibrariesStoreName; + if ( bInplaceStorage ) + { + // create a temporary target storage + const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) ); + sal_Int32 index = 0; + do + { + ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase ); + aTempTargetName.append( index++ ); + + sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear(); + if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + break; + } + while ( true ); + sTempTargetStorName = sTargetLibrariesStoreName; + } + else + { + sTargetLibrariesStoreName = maLibrariesDir; + if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + i_rStorage->removeElement( sTargetLibrariesStoreName ); + } + + xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - #if OSL_DEBUG_LEVEL > 0 - Any aError( ::cppu::getCaughtException() ); - ::rtl::OStringBuffer aMessage; - aMessage.append( "couln't open source library storage.\n\nException:" ); - aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); - #endif + DBG_UNHANDLED_EXCEPTION(); return; } + // open the source storage which might be used to copy yet-unmodified libraries try { - if ( ( mxStorage != xStorage ) && ( mxStorage->hasByName( maLibrariesDir ) ) ) - xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); + if ( mxStorage->hasByName( maLibrariesDir ) ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); + else if ( bInplaceStorage ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ); } catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); + return; } } @@ -1838,7 +1841,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto SfxLibrary* pImplLib = getImplLib( *pName ); if( pImplLib->mbSharedIndexFile ) continue; - bool bExtensionLib = pImplLib->mbExtension; + const bool bExtensionLib = pImplLib->mbExtension; ::xmlscript::LibDescriptor& rLib = bExtensionLib ? aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray]; if( !bExtensionLib ) @@ -1858,12 +1861,14 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto if( pImplLib->implIsModified() || bComplete ) { - // Can we copy the storage? + // Can we simply copy the storage? if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() ) { - try { - xSourceLibrariesStor->copyElementTo( rLib.aName, xLibrariesStor, rLib.aName ); - } catch( uno::Exception& ) + try + { + xSourceLibrariesStor->copyElementTo( rLib.aName, xTargetLibrariesStor, rLib.aName ); + } + catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); // TODO: error handling? @@ -1876,7 +1881,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { try { - xLibraryStor = xLibrariesStor->openStorageElement( + xLibraryStor = xTargetLibrariesStor->openStorageElement( rLib.aName, embed::ElementModes::READWRITE ); } @@ -1908,7 +1913,8 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor ); if( bStorage ) { - try { + try + { uno::Reference< embed::XTransactedObject > xTransact( xLibraryStor, uno::UNO_QUERY_THROW ); xTransact->commit(); } @@ -1928,6 +1934,59 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto rLib.bReadOnly = pImplLib->mbReadOnlyLink; } + // if we did an in-place save into a storage (i.e. a save into the storage we were already based on), + // then we need to clean up the temporary storage we used for this + if ( bInplaceStorage && sTempTargetStorName.getLength() ) + { + OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" ); + try + { + // for this, we first remove everything from the source storage, then copy the complete content + // from the temporary target storage. From then on, what used to be the "source storage" becomes + // the "targt storage" for all subsequent operations. + + // (We cannot simply remove the storage, denoted by maLibrariesDir, from i_rStorage - there might be + // open references to it.) + + if ( xSourceLibrariesStor.is() ) + { + // remove + const Sequence< ::rtl::OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); + pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); + ++pRemoveName + ) + { + xSourceLibrariesStor->removeElement( *pRemoveName ); + } + + // copy + const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); + pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); + ++pCopyName + ) + { + xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + } + } + + // close and remove temp target + xTargetLibrariesStor->dispose(); + i_rStorage->removeElement( sTempTargetStorName ); + xTargetLibrariesStor.clear(); + sTempTargetStorName = ::rtl::OUString(); + + // adjust target + xTargetLibrariesStor = xSourceLibrariesStor; + xSourceLibrariesStor.clear(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + if( !mbOldInfoFormat && !maModifiable.isModified() ) return; maModifiable.setModified( sal_False ); @@ -1953,7 +2012,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); try { - xInfoStream = xLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); + xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY ); OSL_ENSURE ( xProps.is(), "The stream must implement XPropertySet!\n" ); if ( !xProps.is() ) @@ -2012,7 +2071,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto xmlscript::exportLibraryContainer( xHandler, pLibArray ); if ( bStorage ) { - uno::Reference< embed::XTransactedObject > xTransact( xLibrariesStor, uno::UNO_QUERY ); + uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY ); OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" ); if ( !xTransact.is() ) throw uno::RuntimeException(); diff --git a/canvas/source/directx/dx_5rm.cxx b/canvas/source/directx/dx_5rm.cxx index bf3045e52678..642ef7bd7db6 100755 --- a/canvas/source/directx/dx_5rm.cxx +++ b/canvas/source/directx/dx_5rm.cxx @@ -1005,7 +1005,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 849ac3713885..a0f485befa12 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -541,7 +541,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 8aa21853db1a..026545d6c339 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -342,7 +342,7 @@ namespace dxcanvas GraphicsPathSharedPtr pGradientPath( tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); - ENSURE_OR_RETURN( pGradientPath.get(), + ENSURE_OR_RETURN_FALSE( pGradientPath.get(), "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); PathGradientBrushSharedPtr pGradientBrush; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f82ce1344a5c..a83b260d52d5 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1387,7 +1387,7 @@ namespace vclcanvas const ::Size& rSz, const GraphicAttr& rAttr ) const { - ENSURE_OR_RETURN( rGrf, + ENSURE_OR_RETURN_FALSE( rGrf, "Invalid Graphic" ); if( !mpOutDev ) diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 67f537c49b98..14a20e133ff1 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -45,6 +45,8 @@ #include "DataSourceHelper.hxx" #include "ChartModelHelper.hxx" #include "ContainerHelper.hxx" +#include "AxisHelper.hxx" +#include "ThreeDHelper.hxx" #include "TitleWrapper.hxx" #include "ChartDataWrapper.hxx" @@ -64,6 +66,8 @@ #include <svx/unoshcol.hxx> // header for define DBG_ASSERT #include <tools/debug.hxx> +#include <vcl/svapp.hxx> + #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -1308,8 +1312,19 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( if( xDia.is()) { // /-- locked controllers - ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY )); - xTemplate->changeDiagram( xDia ); + Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY ); + ControllerLockGuard aCtrlLockGuard( xModel ); + Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel ); + ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram ); + Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); + DiagramHelper::tTemplateWithServiceName aTemplateWithService( + DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager )); + if( aTemplateWithService.first.is()) + aTemplateWithService.first->resetStyles( xDiagram );//#i109371# + xTemplate->changeDiagram( xDiagram ); + if( Application::GetSettings().GetLayoutRTL() ) + AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) ); + ThreeDHelper::setScheme( xDiagram, e3DScheme ); // \-- locked controllers } else diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index f099eaa8499a..d69212512ebe 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -285,7 +285,7 @@ void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, cons { Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); if( xDiagram.is() ) - ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext ); + ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext, false ); } } @@ -746,7 +746,7 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope aWrappedProperties.push_back( new WrappedProperty( C2U( "FillStyle" ), C2U( "FillStyle" ) ) ); aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparence" ), C2U( "Transparency" ) ) ); - aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_NONE ) ) ); + aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) ); aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparenceGradientName" ), C2U( "TransparencyGradientName" ) ) ); aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientName" ), C2U( "GradientName" ) ) ); aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientStepCount" ), C2U( "GradientStepCount" ) ) ); diff --git a/chart2/source/controller/dialogs/ChangingResource.cxx b/chart2/source/controller/dialogs/ChangingResource.cxx index e7461325e3be..22886c9b6108 100644 --- a/chart2/source/controller/dialogs/ChangingResource.cxx +++ b/chart2/source/controller/dialogs/ChangingResource.cxx @@ -35,6 +35,10 @@ namespace chart { //............................................................................. +ResourceChangeListener::~ResourceChangeListener() +{ +} + ChangingResource::ChangingResource() : m_pChangeListener(0) { diff --git a/chart2/source/controller/dialogs/ChangingResource.hxx b/chart2/source/controller/dialogs/ChangingResource.hxx index df69358b00b7..ed6be33b912e 100644 --- a/chart2/source/controller/dialogs/ChangingResource.hxx +++ b/chart2/source/controller/dialogs/ChangingResource.hxx @@ -42,6 +42,7 @@ class ResourceChangeListener { public: virtual void stateChanged( ChangingResource* pResource ) = 0; + virtual ~ResourceChangeListener(); }; class ChangingResource diff --git a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx index 6462d4897945..b2790a1678bb 100644 --- a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx +++ b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx @@ -44,6 +44,7 @@ class ChartTypeTemplateProvider public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const =0; + virtual ~ChartTypeTemplateProvider() {} }; //............................................................................. diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index f4b314de8a40..244d23ed8eff 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -987,8 +987,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG ) commitToModel( aParameter ); //detect the new ThreeDLookScheme aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) ); - if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple ) - aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple; + if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic ) + aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic; aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel ); this->fillAllControls( aParameter ); @@ -1109,8 +1109,8 @@ void ChartTypeTabPage::initializePage() //set ThreeDLookScheme aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram ); - if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple ) - aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple; + if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic ) + aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic; aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel ); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 352a7e1279cc..ff567636ba0e 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -49,6 +49,7 @@ #include "AxisHelper.hxx" #include "RegressionCurveHelper.hxx" #include "ShapeController.hxx" +#include "DiagramHelper.hxx" #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/beans/XPropertyState.hpp> @@ -115,7 +116,14 @@ bool lcl_deleteDataSeries( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_DATASERIES )))), xUndoManager, xModel ); + + Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) ); + uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) ); + ::chart::DataSeriesHelper::deleteSeries( xSeries, xChartType ); + + ::chart::AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram ); + bResult = true; aUndoGuard.commitAction(); } @@ -575,8 +583,7 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) { OUString aSelObjCID( aSelOID.getObjectCID() ); ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); - if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) - || (OBJECTTYPE_DATA_SERIES == aObjectType) ) + if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) ) return true; if( (OBJECTTYPE_DATA_SERIES == aObjectType) || (OBJECTTYPE_LEGEND_ENTRY == aObjectType) ) return true; @@ -585,6 +592,8 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) return true; if( (OBJECTTYPE_DATA_LABELS == aObjectType) || (OBJECTTYPE_DATA_LABEL == aObjectType) ) return true; + if( (OBJECTTYPE_AXIS == aObjectType) || (OBJECTTYPE_GRID == aObjectType) || (OBJECTTYPE_SUBGRID == aObjectType) ) + return true; } else if ( aSelOID.isAdditionalShape() ) { @@ -628,8 +637,6 @@ bool ChartController::executeDispatch_Delete() return false; //remove chart object - impl_ClearSelection(); - uno::Reference< chart2::XChartDocument > xChartDoc( m_aModel->getModel(), uno::UNO_QUERY ); if( !xChartDoc.is() ) return false; @@ -786,6 +793,24 @@ bool ChartController::executeDispatch_Delete() } break; } + case OBJECTTYPE_AXIS: + { + executeDispatch_DeleteAxis(); + bReturn = true; + break; + } + case OBJECTTYPE_GRID: + { + executeDispatch_DeleteMajorGrid(); + bReturn = true; + break; + } + case OBJECTTYPE_SUBGRID: + { + executeDispatch_DeleteMinorGrid(); + bReturn = true; + break; + } default: { diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index be2a60bb63f7..75e69436a784 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -101,6 +101,9 @@ public: static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); + static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram); + SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties ); static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx index 7cd205b83fb5..fb087abf15fd 100644 --- a/chart2/source/inc/ChartModelHelper.hxx +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -89,6 +89,8 @@ public: , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries ); + static ::com::sun::star::awt::Size getDefaultPageSize(); + static ::com::sun::star::awt::Size getPageSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index c685b99b974f..14113e7396ca 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -172,7 +172,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram, const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > & xContext ); + ::com::sun::star::uno::XComponentContext > & xContext, + bool bAdaptAxes=true ); static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > getAttachedAxis( diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 17d8fe9f3989..cab49e8d0149 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -207,7 +207,7 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO ); - float fDefaultCharHeight = 8.0; + float fDefaultCharHeight = 10.0; ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 77533ec1306b..dc0931f41fc4 100755..100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -106,8 +106,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext) , m_aControllers( m_aModelMutex ) , m_nControllerLockCount(0) , m_xContext( xContext ) - // default visual area is 8 x 7 cm - , m_aVisualAreaSize( 8000, 7000 ) + , m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() ) , m_xDataProvider( 0 ) , m_xInternalDataProvider( 0 ) , m_xPageBackground( new PageBackground( m_xContext ) ) diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index b7b8f380ceea..4f864ae0fd1c 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -464,7 +464,7 @@ void SAL_CALL ChartModel::initNew() { xDiagramProperties->setPropertyValue( C2U("RightAngledAxes"), uno::makeAny( sal_True )); xDiagramProperties->setPropertyValue( C2U("D3DScenePerspective"), uno::makeAny( drawing::ProjectionMode_PARALLEL )); - ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple ); + ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic ); } //set some new 'defaults' for wall and floor diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx index 2ef6be657f8c..4faca33e936c 100644 --- a/chart2/source/model/main/DataSeries.cxx +++ b/chart2/source/model/main/DataSeries.cxx @@ -265,7 +265,7 @@ uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const DataSeriesProperties::AddDefaultsToMap( aStaticDefaults ); CharacterProperties::AddDefaultsToMap( aStaticDefaults ); - float fDefaultCharHeight = 6.0; + float fDefaultCharHeight = 10.0; ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index e3d8a3107d4c..c1143ecdf77a 100644 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -114,7 +114,7 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true ); - float fDefaultCharHeight = 8.0; + float fDefaultCharHeight = 10.0; ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx index 072b16a07d26..5fe21cfb25e0 100644 --- a/chart2/source/model/template/AreaChartTypeTemplate.cxx +++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx @@ -31,6 +31,7 @@ #include "macros.hxx" #include "servicenames_charttypes.hxx" #include "DiagramHelper.hxx" +#include "DataSeriesHelper.hxx" #include "ContainerHelper.hxx" #include "PropertyHelper.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -208,41 +209,26 @@ void SAL_CALL AreaChartTypeTemplate::applyStyle( throw (uno::RuntimeException) { ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); - if( getDimension() == 3 ) - { - try - { - uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW ); - xProp->setPropertyValue( C2U("BorderStyle"), - uno::makeAny( drawing::LineStyle_NONE )); - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } - } + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); } void SAL_CALL AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram ) throw (uno::RuntimeException) { ChartTypeTemplate::resetStyles( xDiagram ); - if( getDimension() == 3 ) + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( + DiagramHelper::getDataSeriesFromDiagram( xDiagram )); + uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE )); + for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin()); + aIt != aSeriesVec.end(); ++aIt ) { - ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( - DiagramHelper::getDataSeriesFromDiagram( xDiagram )); - uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE )); - for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin()); - aIt != aSeriesVec.end(); ++aIt ) + Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY ); + if( xState.is() && + xProp.is() && + xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny ) { - Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY ); - Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY ); - if( xState.is() && - xProp.is() && - xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny ) - { - xState->setPropertyToDefault( C2U("BorderStyle")); - } + xState->setPropertyToDefault( C2U("BorderStyle")); } } } diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx index 81f1337ccb29..01dc4c253d2b 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.cxx +++ b/chart2/source/model/template/BarChartTypeTemplate.cxx @@ -279,6 +279,7 @@ void SAL_CALL BarChartTypeTemplate::applyStyle( throw (uno::RuntimeException) { ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); if( getDimension() == 3 ) { try @@ -300,24 +301,22 @@ void SAL_CALL BarChartTypeTemplate::resetStyles( throw (uno::RuntimeException) { ChartTypeTemplate::resetStyles( xDiagram ); - if( getDimension() == 3 ) + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( + DiagramHelper::getDataSeriesFromDiagram( xDiagram )); + uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE )); + for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin()); + aIt != aSeriesVec.end(); ++aIt ) { - ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( - DiagramHelper::getDataSeriesFromDiagram( xDiagram )); - uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE )); - for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin()); - aIt != aSeriesVec.end(); ++aIt ) + Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY ); + if( xState.is()) { - Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY ); - if( xState.is()) - { + if( getDimension() == 3 ) xState->setPropertyToDefault( C2U("Geometry3D")); - Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY ); - if( xProp.is() && - xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny ) - { - xState->setPropertyToDefault( C2U("BorderStyle")); - } + Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY ); + if( xProp.is() && + xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny ) + { + xState->setPropertyToDefault( C2U("BorderStyle")); } } } diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx index 3f297d1e2e27..59b552cc8995 100644 --- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx +++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx @@ -186,6 +186,7 @@ void SAL_CALL BubbleChartTypeTemplate::applyStyle( throw (uno::RuntimeException) { ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); try { diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx index 70a0a633836a..663cad4c2fe4 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> #include <algorithm> @@ -270,7 +271,11 @@ void SAL_CALL ColumnLineChartTypeTemplate::applyStyle( { ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); - if( nChartTypeIndex==1 ) // lines + if( nChartTypeIndex==0 ) // columns + { + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); + } + else if( nChartTypeIndex==1 ) // lines { Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY ); if( xProp.is() ) diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index a8f2fc12720a..c16682846d53 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -554,12 +554,7 @@ void SAL_CALL PieChartTypeTemplate::applyStyle( } // line style - drawing::LineStyle eStyle = (getDimension() == 2) - ? drawing::LineStyle_SOLID - : drawing::LineStyle_NONE; - - xProp->setPropertyValue( C2U("BorderStyle"), - uno::makeAny( eStyle )); + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); // vary colors by point xProp->setPropertyValue( C2U("VaryColorsByPoint"), uno::makeAny( true )); @@ -616,10 +611,7 @@ void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagr // line style ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); - drawing::LineStyle eStyle = (getDimension() == 2) - ? drawing::LineStyle_SOLID - : drawing::LineStyle_NONE; - uno::Any aLineStyleAny( uno::makeAny( eStyle )); + uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE )); for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin()); aIt != aSeriesVec.end(); ++aIt ) { diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index f952abaa3611..a83d9a8a4ea3 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -235,6 +235,8 @@ void SAL_CALL ScatterChartTypeTemplate::applyStyle( DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex ); DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines ); DataSeriesHelper::makeLinesThickOrThin( xProp, m_nDim==2 ); + if( m_nDim==3 ) + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); } catch( uno::Exception & ex ) { diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index 90a313b78c8a..00ace6c330ad 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -265,10 +265,14 @@ void SAL_CALL StockChartTypeTemplate::applyStyle( if( xProp.is() ) xProp->setPropertyValue( C2U("AttachedAxisIndex"), uno::makeAny( nNewAxisIndex ) ); - - //ensure that lines are on - if( !bHasVolume || nChartTypeIndex==0 ) + if( bHasVolume && nChartTypeIndex==0 ) { + //switch lines off for volume bars + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) ); + } + else + { + //ensure that lines are on if( xProp.is() ) { drawing::LineStyle eStyle = drawing::LineStyle_NONE; @@ -277,6 +281,7 @@ void SAL_CALL StockChartTypeTemplate::applyStyle( xProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID )); } } + } catch( uno::Exception & ex ) { diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index b2f7fb24e6f2..8cdd24e4dc05 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -284,6 +284,26 @@ void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis ) } } +//static +void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram ) +{ + //axis is hidden if no data is attached anymore but data is available + bool bOtherSeriesAttachedToThisAxis = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt = aSeriesVector.begin(); + for( ; aIt != aSeriesVector.end(); ++aIt) + { + uno::Reference< chart2::XAxis > xCurrentAxis( DiagramHelper::getAttachedAxis( *aIt, xDiagram ), uno::UNO_QUERY ); + if( xCurrentAxis==xAxis ) + { + bOtherSeriesAttachedToThisAxis = true; + break; + } + } + if(!bOtherSeriesAttachedToThisAxis && !aSeriesVector.empty() ) + AxisHelper::makeAxisInvisible( xAxis ); +} + void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid , const Reference< XDiagram >& xDiagram ) { diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index ed8c36e08c8d..a49b2abeac98 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -134,9 +134,14 @@ uno::Reference< XChartType > ChartModelHelper::getChartTypeOfSeries( return DiagramHelper::getChartTypeOfSeries( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries ); } +awt::Size ChartModelHelper::getDefaultPageSize() +{ + return awt::Size( 16000, 9000 ); +} + awt::Size ChartModelHelper::getPageSize( const uno::Reference< frame::XModel >& xModel ) { - awt::Size aPageSize( 8000, 7000 ); + awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() ); uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY); DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size"); if( xVisualObject.is() ) diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 9e0b22ba75ac..b851a3864b97 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -441,44 +441,45 @@ bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XC //static sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) { - if( bSimple ) + sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey + if( xChartType .is() ) { - sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40 - if( xChartType .is() ) + rtl::OUString aChartType = xChartType->getChartType(); + if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) { - rtl::OUString aChartType = xChartType->getChartType(); - if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) + if( bSimple ) nRet = static_cast< sal_Int32 >( 0x333333 ); // grey80 - else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE) - || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ) - nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60 + else + nRet = static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30 } - return nRet; + else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE) + || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ) + nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60 } - return static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30 + return nRet; } //static sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) { - if( bSimple ) + sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40 + if( xChartType .is() ) { - sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40 - if( xChartType .is() ) + rtl::OUString aChartType = xChartType->getChartType(); + if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) { - rtl::OUString aChartType = xChartType->getChartType(); - if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) + if( bSimple ) nRet = static_cast< sal_Int32 >( 0xcccccc ); // grey20 + else + nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60 } - return nRet; } - return static_cast< sal_Int32 >( 0x666666 ); // grey60 + return nRet; } drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference< chart2::XChartType >& xChartType ) { - //drawing::Direction3D aRet(0.0, 0.0, 1.0); - drawing::Direction3D aRet(-0.2, 0.7, 0.6); + drawing::Direction3D aRet(0.0, 0.0, 1.0); if( xChartType .is() ) { rtl::OUString aChartType = xChartType->getChartType(); @@ -493,7 +494,7 @@ drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno: drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference< chart2::XChartType >& xChartType ) { - drawing::Direction3D aRet(-0.1, 0.6, 0.8); + drawing::Direction3D aRet(0.0, 0.0, 1.0); if( xChartType .is() ) { rtl::OUString aChartType = xChartType->getChartType(); diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 538f2966105f..acff332d4229 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -595,7 +595,7 @@ void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesPrope if( !xSeriesProperties.is() ) return; - sal_Int32 nNewValue = bThick ? 88 : 0; + sal_Int32 nNewValue = bThick ? 80 : 0; sal_Int32 nOldValue = 0; if( (xSeriesProperties->getPropertyValue( C2U( "LineWidth" )) >>= nOldValue ) && nOldValue != nNewValue ) diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index a8da65e5133d..b95e7522943e 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -599,7 +599,7 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis , const uno::Reference< chart2::XDataSeries >& xDataSeries , const uno::Reference< chart2::XDiagram >& xDiagram , const uno::Reference< uno::XComponentContext > & xContext - ) + , bool bAdaptAxes ) { bool bChanged = false; @@ -610,6 +610,7 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1; sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries); + uno::Reference< chart2::XAxis > xOldAxis( DiagramHelper::getAttachedAxis( xDataSeries, xDiagram ) ); if( nOldAxisIndex != nNewAxisIndex ) { @@ -629,6 +630,11 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis uno::Reference< XAxis > xAxis( AxisHelper::getAxis( 1, bAttachToMainAxis, xDiagram ) ); if(!xAxis.is()) //create an axis if necessary xAxis = AxisHelper::createAxis( 1, bAttachToMainAxis, xDiagram, xContext ); + if( bAdaptAxes ) + { + AxisHelper::makeAxisVisible( xAxis ); + AxisHelper::hideAxisIfNoDataIsAttached( xOldAxis, xDiagram ); + } } return bChanged; diff --git a/chart2/source/tools/LineProperties.cxx b/chart2/source/tools/LineProperties.cxx index cb72d4336faa..95cf95e21a86 100644 --- a/chart2/source/tools/LineProperties.cxx +++ b/chart2/source/tools/LineProperties.cxx @@ -105,7 +105,7 @@ void LineProperties::AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_WIDTH, 0 ); ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_COLOR, 0x000000 ); // black ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_LINE_TRANSPARENCE, 0 ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_NONE ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND ); } //static diff --git a/chart2/source/tools/WrappedIgnoreProperty.cxx b/chart2/source/tools/WrappedIgnoreProperty.cxx index bebbf77ceeef..aaa6c545a799 100644 --- a/chart2/source/tools/WrappedIgnoreProperty.cxx +++ b/chart2/source/tools/WrappedIgnoreProperty.cxx @@ -101,7 +101,7 @@ void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedPrope rList.push_back( new WrappedIgnoreProperty( C2U( "LineColor" ), uno::makeAny( sal_Int32(0) ) ) ); rList.push_back( new WrappedIgnoreProperty( C2U( "LineTransparence" ), uno::makeAny( sal_Int16(0) ) ) ); rList.push_back( new WrappedIgnoreProperty( C2U( "LineWidth" ), uno::makeAny( sal_Int32(0) ) ) ); - rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_NONE ) ) ); + rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) ); } //static diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index 436541ef27ee..1e3e62894741 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -33,6 +33,7 @@ #include "CommonConverters.hxx" #include "AxisHelper.hxx" #include "DiagramHelper.hxx" +#include "ChartModelHelper.hxx" #include <tools/color.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -390,8 +391,8 @@ void AxisProperties::init( bool bCartesian ) //----------------------------------------------------------------------------- AxisLabelProperties::AxisLabelProperties() - : m_aFontReferenceSize( 8000, 7000 ) - , m_aMaximumSpaceForLabels( 0 , 0, 8000, 7000 ) + : m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() ) + , m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height ) , nNumberFormatKey(0) , eStaggering( SIDE_BY_SIDE ) , bLineBreakAllowed( false ) diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 67914f47bac0..fd1aaa81c3a0 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -403,7 +403,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes , Stripe( aPoint1, aPoint2, fDepth ) - , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true ); + , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 ); } } } diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 470796f8fc1e..0d7ef403f87d 100644..100755 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -110,9 +110,16 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const if( m_nDimension == 3 ) { aRet = drawing::Direction3D(1.0,-1.0,1.0); - drawing::Direction3D aScale( this->getPlottingPositionHelper(MAIN_AXIS_INDEX).getScaledLogicWidth() ); + BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) ); + drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() ); if(aScale.DirectionX!=0.0) - aRet.DirectionZ = aScale.DirectionZ/aScale.DirectionX; + { + double fXSlotCount = 1.0; + if(!m_aZSlots.empty()) + fXSlotCount = m_aZSlots.begin()->size(); + + aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getSlotWidth()); + } else return VSeriesPlotter::getPreferredDiagramAspectRatio(); if(aRet.DirectionZ<0.05) @@ -357,7 +364,8 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar( xShape = m_pShapeFactory->createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree ); break; case DataPointGeometry3D::PYRAMID: - xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree ); + xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0 + , xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); break; case DataPointGeometry3D::CUBOID: default: @@ -366,7 +374,8 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar( , PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), bRoundedEdges ); return xShape; } - this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); + if( nGeometry3D != DataPointGeometry3D::PYRAMID ) + this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); return xShape; } @@ -734,6 +743,7 @@ void BarChart::createShapes() double fMiddleHeight = fUpperYValue-fLowerYValue; if(!bPositive) fMiddleHeight*=-1.0; + double fLogicBarDepth = 0.5; if(m_nDimension==3) { if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 ) @@ -744,9 +754,11 @@ void BarChart::createShapes() fLogicBarWidth = fLogicBaseWidth*fHeight/(fCompleteHeight); if(fLogicBarWidth<=0.0) fLogicBarWidth=fLogicBaseWidth; + fLogicBarDepth = fLogicBarDepth*fHeight/(fCompleteHeight); + if(fLogicBarDepth<=0.0) + fLogicBarDepth*=-1.0; } } - double fLogicBarDepth = fLogicBarWidth; //better performance for big data FormerBarPoint aFormerPoint( aSeriesFormerPointMap[pSeries] ); diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index ccba1fdc4106..37888c8f0a9b 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -560,11 +560,17 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re sal_Int32 nYDiff = aTextSize.Height/nLineCountForSymbolsize; sal_Int32 nXDiff = aSymbolSize.Width * nYDiff/aSymbolSize.Height; + // #i109336# Improve auto positioning in chart + nXDiff = nXDiff * 80 / 100; + nYDiff = nYDiff * 80 / 100; + aSymbolSize.Width = nXDiff * 75/100; aSymbolSize.Height = nYDiff * 75/100; awt::Point aSymbolPosition( aUnrotatedTextPos ); - aSymbolPosition.Y += (nYDiff * 25/200); + + // #i109336# Improve auto positioning in chart + aSymbolPosition.Y += ( nYDiff / 4 ); if(LABEL_ALIGN_LEFT==eAlignment || LABEL_ALIGN_LEFT_TOP==eAlignment diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index 51775cdde85b..5ffec22969a0 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -534,6 +534,9 @@ void VDiagram::createShapes_3d() bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram ); + const bool bDoubleSided = false; + const bool bFlatNormals = true; + //add walls { uno::Reference< beans::XPropertySet > xWallProp( NULL ); @@ -544,19 +547,31 @@ void VDiagram::createShapes_3d() if( !bAddFloorAndWall ) aWallCID = rtl::OUString(); uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, aWallCID ) ); + + CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); + //add left wall { + short nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 3 : 1; double xPos = 0.0; - CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); if( CuboidPlanePosition_Right==eLeftWallPos ) xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; Stripe aStripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) - , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) - , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) ); + , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) + , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); + if( CuboidPlanePosition_Right==eLeftWallPos ) + { + nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 2 : 0; + aStripe = Stripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) + , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) + , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) ); + } + aStripe.InvertNormal(true); uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe - , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true, true ); + , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals ); if( !bAddFloorAndWall ) { //we always need this object as dummy object for correct scene dimensions @@ -566,17 +581,25 @@ void VDiagram::createShapes_3d() } //add back wall { + short nRotatedTexture = 0; double zPos = 0.0; - CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); if( CuboidPlanePosition_Front==eBackWallPos ) zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME; Stripe aStripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos) + , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) + , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) ); + if( CuboidPlanePosition_Front==eBackWallPos ) + { + aStripe = Stripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos) , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); + nRotatedTexture = 3; + } + aStripe.InvertNormal(true); uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe - , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true ); + , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals ); if( !bAddFloorAndWall ) { //we always need this object as dummy object for correct scene dimensions @@ -643,44 +666,14 @@ void VDiagram::createShapes_3d() if( m_xDiagram.is() ) xFloorProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getFloor()); - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( C2U( - "com.sun.star.drawing.Shape3DExtrudeObject") ), uno::UNO_QUERY ); - xOuterGroup_Shapes->add(xShape); - uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY ); - if( xShapeProp.is()) - { - //depth - xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_EXTRUDE_DEPTH ) - , uno::makeAny((sal_Int32)FLOOR_THICKNESS) ); - //PercentDiagonal - xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL ) - , uno::makeAny( sal_Int32(0) ) ); - - drawing::Direction3D aSize(FIXED_SIZE_FOR_3D_CHART_VOLUME,FIXED_SIZE_FOR_3D_CHART_VOLUME,FLOOR_THICKNESS); - - //Polygon - drawing::PolyPolygonShape3D aPoly; - AddPointToPoly( aPoly, drawing::Position3D(0,0,0) ); - AddPointToPoly( aPoly, drawing::Position3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) ); - AddPointToPoly( aPoly, drawing::Position3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); - AddPointToPoly( aPoly, drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) ); - AddPointToPoly( aPoly, drawing::Position3D(0,0,0) ); - xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D ), uno::makeAny( aPoly ) ); - - //Matrix for position - { - ::basegfx::B3DHomMatrix aM; - aM.rotate(F_PI/2.0,0.0,0.0); - aM.translate(0.0,FLOOR_THICKNESS, 0.0); - drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM); - E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape )); - xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ) - , uno::makeAny(aHM) ); - } + Stripe aStripe( drawing::Position3D(0,0,0) + , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) + , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) ); + aStripe.InvertNormal(true); - PropertyMapper::setMappedProperties( xShapeProp, xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties() ); - } + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createStripe(xOuterGroup_Shapes, aStripe + , xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, 0, bFlatNormals ); CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) ); if( !bAddFloorAndWall || (CuboidPlanePosition_Bottom!=eBottomPos) ) @@ -709,11 +702,11 @@ void VDiagram::createShapes_3d() try { double fXScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME; - double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -FLOOR_THICKNESS-GRID_TO_WALL_DISTANCE ) /FIXED_SIZE_FOR_3D_CHART_VOLUME; + double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME; double fZScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME; ::basegfx::B3DHomMatrix aM; - aM.translate(GRID_TO_WALL_DISTANCE/fXScale, (FLOOR_THICKNESS+GRID_TO_WALL_DISTANCE)/fYScale, GRID_TO_WALL_DISTANCE/fZScale); + aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale); aM.scale( fXScale, fYScale, fZScale ); E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape )); xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ) diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index e16310a71ce7..ef75f3a323af 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -90,7 +90,11 @@ public: ::com::sun::star::drawing::XShapes >& xTarget , const ::com::sun::star::drawing::Position3D& rPosition , const ::com::sun::star::drawing::Direction3D& rSize - , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ); + , double fTopHeight + , bool bRotateZ + , const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSourceProp + , const tPropertyNameMap& rPropertyNameMap); ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createCone( const ::com::sun::star::uno::Reference< @@ -119,7 +123,9 @@ public: , const Stripe& rStripe , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp , const tPropertyNameMap& rPropertyNameMap - , sal_Bool bDoubleSided = true, bool bRotatedTexture=false ); + , sal_Bool bDoubleSided = true + , short nRotatedTexture = 0 //0 to 7 are the different possibilities + , bool bFlatNormals=true ); ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget @@ -235,7 +241,6 @@ private: , const ::com::sun::star::drawing::Position3D& rPosition , const ::com::sun::star::drawing::Direction3D& rSize , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree - , sal_Int32 nSegments , bool bCylinder = false); //member: diff --git a/chart2/source/view/inc/Stripe.hxx b/chart2/source/view/inc/Stripe.hxx index b176685aefb5..ca1aaf155d1e 100644 --- a/chart2/source/view/inc/Stripe.hxx +++ b/chart2/source/view/inc/Stripe.hxx @@ -53,16 +53,19 @@ public: , const ::com::sun::star::drawing::Position3D& rPoint2 , double fDepth ); -/* Stripe( const ::com::sun::star::drawing::Position3D& rPoint1 , const ::com::sun::star::drawing::Position3D& rPoint2 , const ::com::sun::star::drawing::Position3D& rPoint3 - , const ::com::sun::star::drawing::Position3D& rPoint4 );*/ + , const ::com::sun::star::drawing::Position3D& rPoint4 ); + void SetManualNormal( const ::com::sun::star::drawing::Direction3D& rNormal ); + ::com::sun::star::drawing::Direction3D getNormal() const; + + void InvertNormal( bool bInvertNormal ); ::com::sun::star::uno::An |