diff options
author | Armin Le Grand <alg@apache.org> | 2012-11-14 11:09:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-06 17:24:43 +0100 |
commit | 7c486ba2574486f886612b8c4c130c55acd7d93e (patch) | |
tree | e0ff8ca0306e71bab1ff59932c26e896a596cd07 | |
parent | db77d9700e1301c7cb47a76721639dd4c7829f31 (diff) |
Resolves: #i121334# Changed default for charts background to be none...
(from white) to allow fill settings in the various apps to have an
effect
(cherry picked from commit 0050a8e4eace17ed1b55c7ec919edaa0daadc3a7)
Conflicts:
chart2/source/model/main/PageBackground.cxx
sc/source/ui/drawfunc/fuins2.cxx
sd/source/ui/view/viewshe2.cxx
Related: #i121334# turned back chart non-fill defaults...
done the non-fill using tooling when creating new chart modules
(cherry picked from commit af9220c24c9d80e5415d9d7d8f273b28d0d27cdb)
Conflicts:
chart2/source/model/main/PageBackground.cxx
sc/source/filter/starcalc/scfobj.cxx
sd/source/ui/view/viewshe2.cxx
svx/inc/svx/charthelper.hxx
svx/source/svdraw/charthelper.cxx
sw/source/ui/table/tablemgr.cxx
Related: #i121334# deactivated setting chart OLE background to transparent...
for better UI experience and better back-compatibility to other OpenOffice
derivates
(cherry picked from commit 5fa621198a981ea994d9903298e8a1d884ee686b)
Unname unused arguments to prevent compiler warnings.
(cherry picked from commit c3c4df7647d8d4ab1425bb3c7f38932c4adcbe74)
Change-Id: I1b4579aca701a4d637d21d7963b87f637458d0a5
01855cc3d4ec3c321109f924f6de4cdfbec4cd5d
18757f64ae84a415dc781929db4b76f571172ab1
de9879c2e1c249c0d957e4e46723b167ae1a8e90
-rw-r--r-- | include/svx/charthelper.hxx | 12 | ||||
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/starcalc/scfobj.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chartuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/output3.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsert.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/inc/ViewShell.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/viewshe2.cxx | 30 | ||||
-rw-r--r-- | svx/source/svdraw/charthelper.cxx | 34 | ||||
-rw-r--r-- | sw/source/ui/table/tablemgr.cxx | 4 |
11 files changed, 74 insertions, 53 deletions
diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx index 3b43c4bb7f10..1575a0b78488 100644 --- a/include/svx/charthelper.hxx +++ b/include/svx/charthelper.hxx @@ -24,6 +24,7 @@ #include <basegfx/range/b2drange.hxx> #include <svx/svxdllapi.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <com/sun/star/embed/XEmbeddedObject.hpp> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -45,6 +46,17 @@ public: static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel, basegfx::B2DRange& rRange); + + // #i121334# 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/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 7db78f34805c..87014d749d8b 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -67,6 +67,7 @@ #include <svx/unoapi.hxx> #include <svx/svditer.hxx> #include <editeng/writingmodeitem.hxx> +#include <svx/charthelper.hxx> #include "scitems.hxx" #include <editeng/eeitem.hxx> @@ -1660,6 +1661,10 @@ SdrObject* XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const R ::com::sun::star::awt::Size aAwtSize( aSize.Width(), aSize.Height() ); xEmbObj->setVisualAreaSize( nAspect, aAwtSize ); + // #i121334# This call will change the chart's default background fill from white to transparent. + // Add here again if this is wanted (see task description for details) + // 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 1ce003777c4f..cc05e719a9ec 100644 --- a/sc/source/filter/starcalc/scfobj.cxx +++ b/sc/source/filter/starcalc/scfobj.cxx @@ -25,6 +25,7 @@ using namespace com::sun::star; #include <unotools/moduleoptions.hxx> +#include <svx/charthelper.hxx> #include <svx/svdoole2.hxx> #include <svx/svdpage.hxx> #include <sfx2/objsh.hxx> @@ -76,6 +77,10 @@ void Sc10InsertObject::InsertChart( ScDocument* pDoc, SCTAB nDestTab, const Rect aSz.Height = rRect.GetSize().Height(); xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, aSz ); + // #i121334# This call will change the chart's default background fill from white to transparent. + // Add here again if this is wanted (see task description for details) + // 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 3faea47f1238..5673502d6599 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -43,6 +43,7 @@ #include <svx/svdpage.hxx> #include <svx/svdundo.hxx> #include <sfx2/msgpool.hxx> +#include <svx/charthelper.hxx> #include <scmod.hxx> // BM/IHA -- @@ -81,8 +82,6 @@ using namespace ::com::sun::star; #include "drawview.hxx" #include "markdata.hxx" -extern SdrObject* pSkipPaintObj; // output.cxx - dieses Objekt nicht zeichnen - namespace { void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScViewData* pViewData, @@ -368,12 +367,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie aPnt.X() -= aSize.Width(); // move position to left edge Rectangle aRect (aPnt, aSize); SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect); - - // Dieses Objekt nicht vor dem Aktivieren zeichnen - // (in MarkListHasChanged kommt ein Update) - if (!bIsFromFile) - pSkipPaintObj = pObj; - SdrPageView* pPV = pView->GetSdrPageView(); pView->InsertObjectAtView(pObj, *pPV); @@ -411,7 +404,6 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pVie else { pViewShell->ActivateObject( (SdrOle2Obj*) pObj, SVVERB_SHOW ); - pSkipPaintObj = NULL; } } @@ -628,13 +620,12 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* Rectangle aRect (aStart, aSize); SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect); - - // Dieses Objekt nicht vor dem Aktivieren zeichnen - // (in MarkListHasChanged kommt ein Update) - pSkipPaintObj = pObj; - SdrPageView* pPV = pView->GetSdrPageView(); + // #i121334# This call will change the chart's default background fill from white to transparent. + // Add here again if this is wanted (see task description for details) + // 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 @@ -798,8 +789,6 @@ FuInsertChartFromFile::FuInsertChartFromFile( ScTabViewShell* pViewSh, Window* p Rectangle aRect (aStart, aSize); SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect); - pSkipPaintObj = pObj; - SdrPageView* pPV = pView->GetSdrPageView(); // 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 0db6aace6216..e4b485e6591f 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -33,6 +33,7 @@ #include <unotools/moduleoptions.hxx> #include <comphelper/classids.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <svx/charthelper.hxx> #include "chartuno.hxx" #include "miscuno.hxx" @@ -287,6 +288,10 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, if( xObj.is()) xObj->setVisualAreaSize( nAspect, aSz ); + // #i121334# This call will change the chart's default background fill from white to transparent. + // Add here again if this is wanted (see task description for details) + // ChartHelper::AdaptDefaultsForChart( xObj ); + pPage->InsertObject( pObj ); pModel->AddUndo( new SdrUndoInsertObj( *pObj ) ); } diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx index eb4ff52e69a9..fda65f6f72a4 100644 --- a/sc/source/ui/view/output3.cxx +++ b/sc/source/ui/view/output3.cxx @@ -34,10 +34,6 @@ #include <svx/fmview.hxx> -// STATIC DATA ----------------------------------------------------------- - -SdrObject* pSkipPaintObj = NULL; - //================================================================== // #i72502# diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index abe5311e27ff..48378a4280c0 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -61,8 +61,8 @@ #include <svx/svdpagv.hxx> #include <vcl/msgbox.hxx> #include <sfx2/opengrf.hxx> - #include <sfx2/viewfrm.hxx> +#include <svx/charthelper.hxx> #include "app.hrc" #include "sdresid.hxx" @@ -370,7 +370,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) // note, that this call modified the chart model which // results in a change notification. So call this after // everything else is finished. - mpViewShell->AdaptDefaultsForChart( xObj ); + ChartHelper::AdaptDefaultsForChart( xObj ); } } } diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 94f5d7238a31..a13648054d34 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -419,9 +419,6 @@ public: */ virtual bool RelocateToParentWindow (::Window* pParentWindow); - void AdaptDefaultsForChart( - const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > & xEmbObj ); - /** Depending on the given request create a new page or duplicate an existing one. A new page is created behind the given slide. @param rRequest diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index ac74080916c7..f6586051c4fb 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -69,6 +69,7 @@ #include <sfx2/viewfrm.hxx> #include <svtools/soerr.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <svx/charthelper.hxx> using namespace com::sun::star; @@ -877,7 +878,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) if( bChangeDefaultsForChart && xObj.is()) { - AdaptDefaultsForChart( xObj ); + ChartHelper::AdaptDefaultsForChart( xObj ); } pSdClient->DoVerb(nVerb); // if necessary, ErrCode is outputted by Sfx @@ -1055,33 +1056,6 @@ Point ViewShell::GetViewOrigin() const return mpContentWindow->GetViewOrigin(); } -void ViewShell::AdaptDefaultsForChart( - const uno::Reference < embed::XEmbeddedObject > & xEmbObj ) -{ - 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( "FillStyle" , uno::makeAny( drawing::FillStyle_NONE )); - // set no border - if( xPageProp.is()) - xPageProp->setPropertyValue( "LineStyle" , uno::makeAny( drawing::LineStyle_NONE )); - } - catch( const uno::Exception & ) - { - OSL_FAIL( "Exception caught in AdaptDefaultsForChart" ); - } - } -} - } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx index 9d4c52023595..0676f964d33f 100644 --- a/svx/source/svdraw/charthelper.cxx +++ b/svx/source/svdraw/charthelper.cxx @@ -29,6 +29,9 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/graphic/PrimitiveFactory2D.hpp> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> using namespace ::com::sun::star; @@ -118,4 +121,35 @@ 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( "FillStyle", + uno::makeAny( drawing::FillStyle_NONE )); + // set no border + if( xPageProp.is()) + xPageProp->setPropertyValue( "LineStyle", + uno::makeAny( drawing::LineStyle_NONE )); + } + catch( const uno::Exception & ) + { + OSL_FAIL( "Exception caught in AdaptDefaultsForChart" ); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx index c7e4401cec85..a76b6244b1a1 100644 --- a/sw/source/ui/table/tablemgr.cxx +++ b/sw/source/ui/table/tablemgr.cxx @@ -25,6 +25,7 @@ #include <sot/storage.hxx> #include <comphelper/classids.hxx> +#include <svx/charthelper.hxx> #include "edtwin.hxx" #include "wrtsh.hxx" @@ -265,6 +266,9 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart( //this does the DoVerb in the SfxViewShell. ErrCode nErr = pClient->DoVerb( SVVERB_SHOW ); (void) nErr; + + // #i121334# + ChartHelper::AdaptDefaultsForChart( xObj ); } uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY ); |