diff options
Diffstat (limited to 'svx/source/unodraw/UnoGraphicExporter.cxx')
-rw-r--r-- | svx/source/unodraw/UnoGraphicExporter.cxx | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 6417be63f45c..b80be1076b7e 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -615,32 +615,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); - // create a view - SdrView* pView; - - if( PTR_CAST( FmFormModel, mpDoc ) ) - { - pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); - } - else - { - pView = new SdrView( mpDoc, &aVDev ); - } - - pView->SetBordVisible( FALSE ); - pView->SetPageVisible( FALSE ); - pView->ShowSdrPage( pPage ); - SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); + SdrObject* pTempBackgroundShape = 0; std::vector< SdrObject* > aShapes; bool bRet = true; @@ -649,19 +634,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { - SdrObject* pShape = 0; - if( pPage->IsMasterPage() ) - { - if( pPage->GetObjCount() > 0 ) - pShape = pPage->GetObj(0); - } - else - { - pShape = pPage->GetBackgroundObj(); - } - - if( pShape ) - aShapes.push_back( pShape ); + pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); + pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); + pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); + aShapes.push_back(pTempBackgroundShape); } else { @@ -738,8 +714,24 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); aVDev.EnableOutput( FALSE ); aMtf.Record( &aVDev ); - Size aNewSize; + + // create a view + SdrView* pView; + + if( PTR_CAST( FmFormModel, mpDoc ) ) + { + pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); + } + else + { + pView = new SdrView( mpDoc, &aVDev ); + } + + pView->SetBordVisible( FALSE ); + pView->SetPageVisible( FALSE ); + pView->ShowSdrPage( pPage ); + if ( pView && pPage ) { pView->SetBordVisible( FALSE ); @@ -780,6 +772,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } + if ( pView ) + { + pView->HideSdrPage(); + delete pView; + } + if( rSettings.mbTranslucent ) { Size aOutSize; @@ -904,15 +902,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; - if(rSettings.mbExportOnlyBackground) - { - // shape is MPBGO and if it's not yet set, it's size will - // be empty when using GetCurrentBoundRect(). Since anyways - // the page size is used by MPBGO and MPBGO is EOLd, get - // the wanted size from the page model directly - aBound = Rectangle(Point(0,0), pPage->GetSize()); - } - else { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -986,10 +975,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } - if ( pView ) + if(pTempBackgroundShape) { - pView->HideSdrPage(); - delete pView; + SdrObject::Free(pTempBackgroundShape); } rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); |