Kaydet (Commit) af9220c2 authored tarafından Armin Le Grand's avatar Armin Le Grand

#121334# turbned back chart non-fill defaults, done the non-fill using tooling…

#121334# turbned back chart non-fill defaults, done the non-fill using tooling when chreating new chart modules
üst 0050a8e4
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "PropertyHelper.hxx" #include "PropertyHelper.hxx"
#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <rtl/uuid.h> #include <rtl/uuid.h>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
...@@ -65,9 +64,7 @@ private: ...@@ -65,9 +64,7 @@ private:
::chart::FillProperties::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap );
// override other defaults // override other defaults
// #121334# As default, do not fill the chart page background; we want to be able to have the background ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff );
// 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( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
} }
}; };
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include <svx/unoapi.hxx> #include <svx/unoapi.hxx>
#include <svx/svditer.hxx> #include <svx/svditer.hxx>
#include <editeng/writingmodeitem.hxx> #include <editeng/writingmodeitem.hxx>
#include <svx/charthelper.hxx>
#include "scitems.hxx" #include "scitems.hxx"
#include <editeng/eeitem.hxx> #include <editeng/eeitem.hxx>
...@@ -1731,6 +1732,9 @@ SdrObject* XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const R ...@@ -1731,6 +1732,9 @@ SdrObject* XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const R
::com::sun::star::awt::Size aAwtSize( aSize.Width(), aSize.Height() ); ::com::sun::star::awt::Size aAwtSize( aSize.Width(), aSize.Height() );
xEmbObj->setVisualAreaSize( nAspect, aAwtSize ); xEmbObj->setVisualAreaSize( nAspect, aAwtSize );
// #121334#
ChartHelper::AdaptDefaultsForChart( xEmbObj );
// create the container OLE object // create the container OLE object
xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) ); xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) );
} }
......
...@@ -41,6 +41,7 @@ using namespace com::sun::star; ...@@ -41,6 +41,7 @@ using namespace com::sun::star;
#include <sot/storage.hxx> #include <sot/storage.hxx>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <sot/clsids.hxx> #include <sot/clsids.hxx>
#include <svx/charthelper.hxx>
#include "address.hxx" #include "address.hxx"
#include "scfobj.hxx" #include "scfobj.hxx"
...@@ -86,6 +87,9 @@ void Sc10InsertObject::InsertChart( ScDocument* pDoc, SCTAB nDestTab, const Rect ...@@ -86,6 +87,9 @@ void Sc10InsertObject::InsertChart( ScDocument* pDoc, SCTAB nDestTab, const Rect
aSz.Height = rRect.GetSize().Height(); aSz.Height = rRect.GetSize().Height();
xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, aSz ); xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, aSz );
// #121334#
ChartHelper::AdaptDefaultsForChart( xObj );
// hier kann das Chart noch nicht mit Daten gefuettert werden, // hier kann das Chart noch nicht mit Daten gefuettert werden,
// weil die Formeln noch nicht berechnet sind. // weil die Formeln noch nicht berechnet sind.
// Deshalb in die ChartCollection, die Daten werden dann im // Deshalb in die ChartCollection, die Daten werden dann im
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <svx/svdpage.hxx> #include <svx/svdpage.hxx>
#include <svx/svdundo.hxx> #include <svx/svdundo.hxx>
#include <sfx2/msgpool.hxx> #include <sfx2/msgpool.hxx>
#include <svx/charthelper.hxx>
#include <scmod.hxx> #include <scmod.hxx>
// BM/IHA -- // BM/IHA --
...@@ -665,6 +666,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* ...@@ -665,6 +666,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect); SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
SdrPageView* pPV = pView->GetSdrPageView(); 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 // 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 // use the page instead of the view to insert, so no undo action is created yet
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <unotools/moduleoptions.hxx> #include <unotools/moduleoptions.hxx>
#include <sot/clsids.hxx> #include <sot/clsids.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <svx/charthelper.hxx>
#include "chartuno.hxx" #include "chartuno.hxx"
#include "miscuno.hxx" #include "miscuno.hxx"
...@@ -291,6 +292,9 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName, ...@@ -291,6 +292,9 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName,
if( xObj.is()) if( xObj.is())
xObj->setVisualAreaSize( nAspect, aSz ); xObj->setVisualAreaSize( nAspect, aSz );
// #121334#
ChartHelper::AdaptDefaultsForChart( xObj );
pPage->InsertObject( pObj ); pPage->InsertObject( pObj );
pModel->AddUndo( new SdrUndoNewObj( *pObj ) ); pModel->AddUndo( new SdrUndoNewObj( *pObj ) );
......
...@@ -71,8 +71,8 @@ ...@@ -71,8 +71,8 @@
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#endif #endif
#include <sfx2/opengrf.hxx> #include <sfx2/opengrf.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <svx/charthelper.hxx>
#include "app.hrc" #include "app.hrc"
#include "misc.hxx" #include "misc.hxx"
...@@ -394,6 +394,14 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) ...@@ -394,6 +394,14 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
aVisualSize.Height = aTmp.Height(); aVisualSize.Height = aTmp.Height();
xObj->setVisualAreaSize( nAspect, aVisualSize ); xObj->setVisualAreaSize( nAspect, aVisualSize );
mpViewShell->ActivateObject(pOleObj, SVVERB_SHOW); 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 else
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <svtools/soerr.hxx> #include <svtools/soerr.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <svx/charthelper.hxx>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma optimize ( "", off ) #pragma optimize ( "", off )
...@@ -832,6 +833,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) ...@@ -832,6 +833,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
GetDocSh()->SetWaitCursor( sal_True ); GetDocSh()->SetWaitCursor( sal_True );
SfxViewShell* pViewShell = GetViewShell(); SfxViewShell* pViewShell = GetViewShell();
OSL_ASSERT (pViewShell!=NULL); OSL_ASSERT (pViewShell!=NULL);
bool bChangeDefaultsForChart = false;
uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef(); uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
if ( !xObj.is() ) if ( !xObj.is() )
...@@ -848,6 +850,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) ...@@ -848,6 +850,7 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
if( SvtModuleOptions().IsChart() ) if( SvtModuleOptions().IsChart() )
{ {
aClass = SvGlobalName( SO3_SCH_CLASSID ); aClass = SvGlobalName( SO3_SCH_CLASSID );
bChangeDefaultsForChart = true;
} }
} }
else if( aName.EqualsAscii( "StarCalc" )) else if( aName.EqualsAscii( "StarCalc" ))
...@@ -972,6 +975,11 @@ sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) ...@@ -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 // the object area size must be set after scaling, since it triggers the resizing
pSdClient->SetObjArea(aRect); pSdClient->SetObjArea(aRect);
if( bChangeDefaultsForChart && xObj.is())
{
ChartHelper::AdaptDefaultsForChart( xObj );
}
pSdClient->DoVerb(nVerb); // ErrCode wird ggf. vom Sfx ausgegeben pSdClient->DoVerb(nVerb); // ErrCode wird ggf. vom Sfx ausgegeben
pViewShell->GetViewFrame()->GetBindings().Invalidate( pViewShell->GetViewFrame()->GetBindings().Invalidate(
SID_NAVIGATOR_STATE, sal_True, sal_False); SID_NAVIGATOR_STATE, sal_True, sal_False);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// predeclarations // predeclarations
...@@ -48,6 +49,17 @@ public: ...@@ -48,6 +49,17 @@ public:
static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence( static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel,
basegfx::B2DRange& rRange); 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);
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
......
...@@ -33,14 +33,9 @@ ...@@ -33,14 +33,9 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> #include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
#include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx>
#include <com/sun/star/chart2/XChartDocument.hpp>
//// header for function rtl_createUuid #include <com/sun/star/drawing/FillStyle.hpp>
//#include <rtl/uuid.h> #include <com/sun/star/drawing/LineStyle.hpp>
//#include <vcl/pdfextoutdevdata.hxx>
//
//#include <com/sun/star/lang/XUnoTunnel.hpp>
//#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//#include <svtools/embedhlp.hxx>
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -139,5 +134,36 @@ drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContent ...@@ -139,5 +134,36 @@ drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContent
return aRetval; 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 // eof
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <sot/storage.hxx> #include <sot/storage.hxx>
#include <sot/clsids.hxx> #include <sot/clsids.hxx>
#include <svx/charthelper.hxx>
#include "edtwin.hxx" #include "edtwin.hxx"
#include "errhdl.hxx" #include "errhdl.hxx"
...@@ -278,6 +279,9 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart( ...@@ -278,6 +279,9 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
//DoVerb in der SfxViewShell //DoVerb in der SfxViewShell
ErrCode nErr = pClient->DoVerb( SVVERB_SHOW ); ErrCode nErr = pClient->DoVerb( SVVERB_SHOW );
(void) nErr; (void) nErr;
// #121334#
ChartHelper::AdaptDefaultsForChart( xObj );
} }
uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY ); uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment