diff options
author | Armin Le Grand <alg@apache.org> | 2012-11-14 12:24:03 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-11-14 12:24:03 +0000 |
commit | af9220c24c9d80e5415d9d7d8f273b28d0d27cdb (patch) | |
tree | 69694542c9a2b6f285bf1c9c85e3102daa077f04 | |
parent | 0050a8e4eace17ed1b55c7ec919edaa0daadc3a7 (diff) |
#121334# turbned back chart non-fill defaults, done the non-fill using tooling when chreating new chart modules
Notes
Notes:
merged as: 7c486ba2574486f886612b8c4c130c55acd7d93e
-rwxr-xr-x | chart2/source/model/main/PageBackground.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/starcalc/scfobj.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chartuno.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/viewshe2.cxx | 8 | ||||
-rw-r--r-- | svx/inc/svx/charthelper.hxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/charthelper.cxx | 42 | ||||
-rw-r--r-- | sw/source/ui/table/tablemgr.cxx | 4 |
10 files changed, 84 insertions, 13 deletions
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx index c06c410a8468..58bf42c96a83 100755 --- a/chart2/source/model/main/PageBackground.cxx +++ b/chart2/source/model/main/PageBackground.cxx @@ -32,7 +32,6 @@ #include "PropertyHelper.hxx" #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/drawing/FillStyle.hpp> #include <rtl/uuid.h> #include <cppuhelper/queryinterface.hxx> @@ -65,9 +64,7 @@ private: ::chart::FillProperties::AddDefaultsToMap( rOutMap ); // override other defaults - // #121334# As default, do not fill the chart page background; we want to be able to have the background - // of the object containing the chart to define this background fill (evtl. with different methodologies) - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE ); + ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); } }; diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 534e44a5f308..a60993d7319a 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -75,6 +75,7 @@ #include <svx/unoapi.hxx> #include <svx/svditer.hxx> #include <editeng/writingmodeitem.hxx> +#include <svx/charthelper.hxx> #include "scitems.hxx" #include <editeng/eeitem.hxx> @@ -1731,6 +1732,9 @@ SdrObject* XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const R ::com::sun::star::awt::Size aAwtSize( aSize.Width(), aSize.Height() ); xEmbObj->setVisualAreaSize( nAspect, aAwtSize ); + // #121334# + ChartHelper::AdaptDefaultsForChart( xEmbObj ); + // create the container OLE object xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) ); } diff --git a/sc/source/filter/starcalc/scfobj.cxx b/sc/source/filter/starcalc/scfobj.cxx index d865ab933f2e..97f5e456da1d 100644 --- a/sc/source/filter/starcalc/scfobj.cxx +++ b/sc/source/filter/starcalc/scfobj.cxx @@ -41,6 +41,7 @@ using namespace com::sun::star; #include <sot/storage.hxx> #include <sfx2/app.hxx> #include <sot/clsids.hxx> +#include <svx/charthelper.hxx> #include "address.hxx" #include "scfobj.hxx" @@ -86,6 +87,9 @@ void Sc10InsertObject::InsertChart( ScDocument* pDoc, SCTAB nDestTab, const Rect aSz.Height = rRect.GetSize().Height(); xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, aSz ); + // #121334# + ChartHelper::AdaptDefaultsForChart( xObj ); + // hier kann das Chart noch nicht mit Daten gefuettert werden, // weil die Formeln noch nicht berechnet sind. // Deshalb in die ChartCollection, die Daten werden dann im diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 81f3412b1ffd..f2bfe807ade2 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -51,6 +51,7 @@ #include <svx/svdpage.hxx> #include <svx/svdundo.hxx> #include <sfx2/msgpool.hxx> +#include <svx/charthelper.hxx> #include <scmod.hxx> // BM/IHA -- @@ -665,6 +666,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect); SdrPageView* pPV = pView->GetSdrPageView(); + // #121334# + ChartHelper::AdaptDefaultsForChart( xObj ); + // pView->InsertObjectAtView(pObj, *pPV);//this call leads to an immidiate redraw and asks the chart for a visual representation // use the page instead of the view to insert, so no undo action is created yet diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 4a667f05e4c7..6f896ac8b717 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -39,6 +39,7 @@ #include <unotools/moduleoptions.hxx> #include <sot/clsids.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <svx/charthelper.hxx> #include "chartuno.hxx" #include "miscuno.hxx" @@ -291,6 +292,9 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName, if( xObj.is()) xObj->setVisualAreaSize( nAspect, aSz ); + // #121334# + ChartHelper::AdaptDefaultsForChart( xObj ); + pPage->InsertObject( pObj ); pModel->AddUndo( new SdrUndoNewObj( *pObj ) ); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index da76c767b1a1..0fe881b4f0ee 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -71,8 +71,8 @@ #include <vcl/msgbox.hxx> #endif #include <sfx2/opengrf.hxx> - #include <sfx2/viewfrm.hxx> +#include <svx/charthelper.hxx> #include "app.hrc" #include "misc.hxx" @@ -394,6 +394,14 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) aVisualSize.Height = aTmp.Height(); xObj->setVisualAreaSize( nAspect, aVisualSize ); mpViewShell->ActivateObject(pOleObj, SVVERB_SHOW); + + if (nSlotId == SID_INSERT_DIAGRAM) + { + // note, that this call modified the chart model which + // results in a change notification. So call this after + // everything else is finished. + ChartHelper::AdaptDefaultsForChart( xObj ); + } } } else diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 2f1fffae12d3..85a3ffad1ced 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -83,6 +83,7 @@ #include <sfx2/viewfrm.hxx> #include <svtools/soerr.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <svx/charthelper.hxx> #ifdef _MSC_VER #pragma optimize ( "", off ) @@ -832,6 +833,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) GetDocSh()->SetWaitCursor( sal_True ); SfxViewShell* pViewShell = GetViewShell(); OSL_ASSERT (pViewShell!=NULL); + bool bChangeDefaultsForChart = false; uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef(); if ( !xObj.is() ) @@ -848,6 +850,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) if( SvtModuleOptions().IsChart() ) { aClass = SvGlobalName( SO3_SCH_CLASSID ); + bChangeDefaultsForChart = true; } } else if( aName.EqualsAscii( "StarCalc" )) @@ -972,6 +975,11 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) // the object area size must be set after scaling, since it triggers the resizing pSdClient->SetObjArea(aRect); + if( bChangeDefaultsForChart && xObj.is()) + { + ChartHelper::AdaptDefaultsForChart( xObj ); + } + pSdClient->DoVerb(nVerb); // ErrCode wird ggf. vom Sfx ausgegeben pViewShell->GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, sal_True, sal_False); diff --git a/svx/inc/svx/charthelper.hxx b/svx/inc/svx/charthelper.hxx index 4a0ac0d5eb95..9cfcaac84d85 100644 --- a/svx/inc/svx/charthelper.hxx +++ b/svx/inc/svx/charthelper.hxx @@ -27,6 +27,7 @@ #include <basegfx/range/b2drange.hxx> #include <svx/svxdllapi.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <com/sun/star/embed/XEmbeddedObject.hpp> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -48,6 +49,17 @@ public: static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel, basegfx::B2DRange& rRange); + + // #121334# Allow to switch off line and fill style by setting these as attributes + // at the OLE chart object. This is needed to allow fill styles of the covering objects + // to make their own fill/line settings work. This should not be done by changing + // the defaults at the chart (see StaticPageBackgroundDefaults_Initializer::lcl_AddDefaultsToMap) + // since this would not be saved/loaded, thus the compatibility will be better when setting it at + // newly created charts using this method + static void AdaptDefaultsForChart( + const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > & xEmbObj, + bool bNoFillStyle = true, + bool bNoLineStyle = true); }; ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx index 550960659ecf..493ce648208f 100644 --- a/svx/source/svdraw/charthelper.cxx +++ b/svx/source/svdraw/charthelper.cxx @@ -33,14 +33,9 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> #include <drawinglayer/geometry/viewinformation2d.hxx> - -//// header for function rtl_createUuid -//#include <rtl/uuid.h> -//#include <vcl/pdfextoutdevdata.hxx> -// -//#include <com/sun/star/lang/XUnoTunnel.hpp> -//#include <com/sun/star/lang/XMultiServiceFactory.hpp> -//#include <svtools/embedhlp.hxx> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> ////////////////////////////////////////////////////////////////////////////// @@ -139,5 +134,36 @@ drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContent return aRetval; } +void ChartHelper::AdaptDefaultsForChart( + const uno::Reference < embed::XEmbeddedObject > & xEmbObj, + bool bNoFillStyle, + bool bNoLineStyle) +{ + if( xEmbObj.is()) + { + uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY ); + OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" ); + if( !xChartDoc.is()) + return; + + try + { + // set background to transparent (none) + uno::Reference< beans::XPropertySet > xPageProp( xChartDoc->getPageBackground()); + if( xPageProp.is()) + xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FillStyle")), + uno::makeAny( drawing::FillStyle_NONE )); + // set no border + if( xPageProp.is()) + xPageProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineStyle")), + uno::makeAny( drawing::LineStyle_NONE )); + } + catch( const uno::Exception & ) + { + OSL_ENSURE( false, "Exception caught in AdaptDefaultsForChart" ); + } + } +} + ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx index 0e3d0d735855..25d91c5b1b87 100644 --- a/sw/source/ui/table/tablemgr.cxx +++ b/sw/source/ui/table/tablemgr.cxx @@ -31,6 +31,7 @@ #include <sot/storage.hxx> #include <sot/clsids.hxx> +#include <svx/charthelper.hxx> #include "edtwin.hxx" #include "errhdl.hxx" @@ -278,6 +279,9 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart( //DoVerb in der SfxViewShell ErrCode nErr = pClient->DoVerb( SVVERB_SHOW ); (void) nErr; + + // #121334# + ChartHelper::AdaptDefaultsForChart( xObj ); } uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY ); |