[Libreoffice-commits] core.git: Branch 'feature/graphicobject' - editeng/source include/svx svtools/source svx/source sw/source

Norbert Thiebaud nthiebaud at gmail.com
Sat Sep 28 08:10:33 PDT 2013


 editeng/source/uno/unonrule.cxx                 |    6 +++---
 include/svx/svdograf.hxx                        |    2 +-
 include/svx/xbtmpit.hxx                         |    2 +-
 svtools/source/graphic/grfcache.cxx             |    6 +++---
 svx/source/gallery2/galctrl.cxx                 |   23 ++++++++++-------------
 svx/source/sdr/contact/viewcontactofgraphic.cxx |    4 ++--
 svx/source/svdraw/svdograf.cxx                  |    8 ++++----
 sw/source/core/graphic/ndgrf.cxx                |   12 +++++++-----
 8 files changed, 31 insertions(+), 32 deletions(-)

New commits:
commit 01c64f9dffe04c3d3ff0c81ca740827d658ea3da
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Sep 28 17:09:33 2013 +0200

    save commit: fix various breakage due to GraphicObject... need rebase -i
    
    Change-Id: Ia131c13b8831dc994d5866f968fc3e196ff69972

diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index b83eaab..98b59ee 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -225,7 +225,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sa
 
     {
         const SvxBrushItem* pBrush = rFmt.GetBrush();
-        if(pBrush && pBrush->GetGraphicObject().is())
+        if(pBrush)
         {
             const rtl::Reference<GraphicObject> xGrafObj = pBrush->GetGraphicObject();
             OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
@@ -463,8 +463,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
     {
         if( NULL == aFmt.GetBrush() )
         {
-            rtl::Reference< GraphicObject > xGrafObj = rtl::Reference< GraphicObject >();
-            SvxBrushItem aBrushItem( rtl::Reference< GraphicObject >(), GPOS_AREA, SID_ATTR_BRUSH );
+            rtl::Reference< GraphicObject > xGrafObj = GraphicObject::Create(Graphic());
+            SvxBrushItem aBrushItem( xGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
             aFmt.SetGraphicBrush( &aBrushItem );
         }
     }
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 2278cbc..b88d1aa 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -99,7 +99,7 @@ private:
     void                    ImpLinkAbmeldung();
     bool                    ImpUpdateGraphicLink( bool bAsynchron = true ) const;
     void                    ImpSetLinkedGraphic( const Graphic& rGraphic );
-                            DECL_LINK( ImpSwapHdl, GraphicObject* );
+    DECL_LINK( ImpSwapHdl, rtl::Reference<GraphicObject>* );
     void onGraphicChanged();
 
 public:
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index 2354b14..ea9fb7a 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -43,7 +43,7 @@ private:
 
 public:
             TYPEINFO();
-            XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) { mxGraphicObject = rtl::Reference< GraphicObject >(); }
+            XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) { mxGraphicObject = GraphicObject::Create(Graphic()); }
             explicit XFillBitmapItem(const Graphic & rGraphic);
             explicit XFillBitmapItem(const BitmapEx & rBitmapEx);
             explicit XFillBitmapItem(const rtl::Reference< GraphicObject > & xGraphicObject);
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 28f2120..f0b4475 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -185,7 +185,7 @@ GraphicCacheEntry::GraphicCacheEntry( const rtl::Reference< GraphicObject >& xOb
     mbSwappedAll    ( true )
 {
     mbSwappedAll = !ImplInit( xObj );
-    maGraphicObjectList.push_back( (GraphicObject*)&xObj );
+    maGraphicObjectList.push_back( xObj );
 }
 
 GraphicCacheEntry::~GraphicCacheEntry()
@@ -318,14 +318,14 @@ void GraphicCacheEntry::AddGraphicObjectReference( const rtl::Reference< Graphic
         mbSwappedAll = !ImplInit( xObj );
 
     ImplFillSubstitute( rSubstitute );
-    maGraphicObjectList.push_back( (GraphicObject*) &xObj );
+    maGraphicObjectList.push_back( xObj );
 }
 
 bool GraphicCacheEntry::ReleaseGraphicObjectReference( const rtl::Reference< GraphicObject >& xObj )
 {
     for( GraphicObjectList_impl::iterator it = maGraphicObjectList.begin();
          it != maGraphicObjectList.end(); ++it ) {
-        if( *xObj.get() == *it->get() )
+        if( xObj.get() == (*it).get() )
         {
             maGraphicObjectList.erase( it );
             return true;
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index a730371..035fb28 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -49,7 +49,7 @@ GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme )
 
     SetHelpId( HID_GALLERY_WINDOW );
     InitSettings();
-    mxGraphicObj = rtl::Reference< GraphicObject >();
+    mxGraphicObj = GraphicObject::Create(Graphic());
 }
 
 GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId  ) :
@@ -62,7 +62,7 @@ GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId  ) :
 
     SetHelpId( HID_GALLERY_PREVIEW );
     InitSettings();
-    mxGraphicObj = rtl::Reference< GraphicObject >();
+    mxGraphicObj = GraphicObject::Create(Graphic());
 }
 
 GalleryPreview::~GalleryPreview()
@@ -98,7 +98,7 @@ bool GalleryPreview::SetGraphic( const INetURLObject& _aURL )
 
 void GalleryPreview::ClearGraphic()
 {
-    mxGraphicObj.clear();
+    mxGraphicObj = GraphicObject::Create(Graphic());
 }
 
 void GalleryPreview::InitSettings()
@@ -152,18 +152,15 @@ sal_Bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rect
 void GalleryPreview::Paint( const Rectangle& rRect )
 {
     Window::Paint( rRect );
-    if(mxGraphicObj.is())
+    if( ImplGetGraphicCenterRect( mxGraphicObj->GetGraphic(), maPreviewRect ) )
     {
-        if( ImplGetGraphicCenterRect( mxGraphicObj->GetGraphic(), maPreviewRect ) )
-        {
-            const Point aPos( maPreviewRect.TopLeft() );
-            const Size  aSize( maPreviewRect.GetSize() );
+        const Point aPos( maPreviewRect.TopLeft() );
+        const Size  aSize( maPreviewRect.GetSize() );
 
-            if( mxGraphicObj->IsAnimated() )
-                mxGraphicObj->StartAnimation( this, aPos, aSize );
-            else
-                mxGraphicObj->Draw( this, aPos, aSize );
-        }
+        if( mxGraphicObj->IsAnimated() )
+            mxGraphicObj->StartAnimation( this, aPos, aSize );
+        else
+            mxGraphicObj->Draw( this, aPos, aSize );
     }
 }
 
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 04d2c7d..e6251fe 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -87,7 +87,7 @@ namespace sdr
             const GraphicAttr& rLocalGrafInfo) const
         {
             drawinglayer::primitive2d::Primitive2DSequence xRetval;
-            rtl::Reference< GraphicObject > xEmptyGraphicObject= rtl::Reference< GraphicObject >();
+            rtl::Reference< GraphicObject > xEmptyGraphicObject= GraphicObject::Create(Graphic());
             GraphicAttr aEmptyGraphicAttr;
 
             // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
@@ -150,7 +150,7 @@ namespace sdr
             const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
         {
             drawinglayer::primitive2d::Primitive2DSequence xRetval;
-            rtl::Reference< GraphicObject > xEmptyGraphicObject = rtl::Reference< GraphicObject >();
+            rtl::Reference< GraphicObject > xEmptyGraphicObject = GraphicObject::Create(Graphic());
             GraphicAttr aEmptyGraphicAttr;
 
             // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index d51ef7a..39bdaf9 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -331,7 +331,7 @@ SdrGrafObj::SdrGrafObj()
     pGraphicLink    ( NULL ),
     bMirrored       ( false )
 {
-    mxGraphic = rtl::Reference<GraphicObject>();
+    mxGraphic = GraphicObject::Create(Graphic());
     mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
     onGraphicChanged();
 
@@ -1273,11 +1273,11 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
     }
 }
 
-IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
+IMPL_LINK( SdrGrafObj, ImpSwapHdl, rtl::Reference<GraphicObject>*, pO )
 {
     SvStream* pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
 
-    if( pO->IsInSwapOut() )
+    if( (*pO)->IsInSwapOut() )
     {
         if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && mxGraphic->GetSizeBytes() > 20480 )
         {
@@ -1308,7 +1308,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
             }
         }
     }
-    else if( pO->IsInSwapIn() )
+    else if( (*pO)->IsInSwapIn() )
     {
         // can be loaded from the original document stream later
         if( pModel != NULL )
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 09449a0..09c22f0 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -62,7 +62,7 @@ SwGrfNode::SwGrfNode(
         SwGrfFmtColl *pGrfColl,
         SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
-    mxGrfObj(),
+    mxGrfObj(GraphicObject::Create(Graphic())),
     mxReplacementGraphic(),
     // #i73788#
     mbLinkedInputStreamReady( false ),
@@ -72,7 +72,7 @@ SwGrfNode::SwGrfNode(
         bFrameInPaint = bScaleImageMap = sal_False;
 
     bGrafikArrived = sal_True;
-    ReRead(rGrfName,rFltName, pGraphic, mxGrfObj.is() ? mxGrfObj.get() : NULL, sal_False);
+    ReRead(rGrfName,rFltName, pGraphic, mxGrfObj.get(), sal_False);
     mxGrfObj->SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
 }
 
@@ -105,7 +105,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
                       SwGrfFmtColl *pGrfColl,
                       SwAttrSet* pAutoAttr ) :
     SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
-    mxGrfObj(),
+    mxGrfObj(GraphicObject::Create(Graphic())),
     mxReplacementGraphic(),
     // #i73788#
     mbLinkedInputStreamReady( false ),
@@ -245,8 +245,10 @@ sal_Bool SwGrfNode::ReRead(
         bReadGrf = sal_True;
     }
     // Was the graphic already loaded?
-    else if( !bNewGrf && mxGrfObj.is() && GRAPHIC_NONE != mxGrfObj->GetType() )
+    else if( !bNewGrf && GRAPHIC_NONE != mxGrfObj->GetType() )
+    {
         return sal_True;
+    }
     else
     {
         if( HasStreamName() )
@@ -501,7 +503,7 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
                     // no default bitmap anymore, thus re-paint
                     mxReplacementGraphic.clear();
 
-                    mxGrfObj = rtl::Reference<GraphicObject>();
+                    mxGrfObj = GraphicObject::Create(Graphic());
                     onGraphicChanged();
                     SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
                     ModifyNotification( &aMsgHint, &aMsgHint );


More information about the Libreoffice-commits mailing list