[Libreoffice-commits] .: 3 commits - sd/sdi sd/source svx/inc svx/sdi

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 07:01:12 PST 2012


 sd/sdi/_drvwsh.sdi               |    5 ++
 sd/source/ui/app/popup2_tmpl.src |    1 
 sd/source/ui/func/fuinsert.cxx   |    5 +-
 sd/source/ui/inc/View.hxx        |    4 +
 sd/source/ui/view/drviews8.cxx   |    1 
 sd/source/ui/view/sdview5.cxx    |   90 ++++++++++++++++++++++-----------------
 svx/inc/globlmn_tmpl.hrc         |    5 ++
 svx/inc/svx/svxids.hrc           |   11 ++--
 svx/sdi/svx.sdi                  |   24 ++++++++++
 9 files changed, 102 insertions(+), 44 deletions(-)

New commits:
commit c349164824d7c4d467a7a9a9148a7cd6555e3684
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Dec 4 15:58:21 2012 +0100

    added Change picture menu item to graphic shape popup
    
    Change-Id: I6e4927b847ca6990990be1075c8371404736e27e

diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 5cbbefa..98f1539 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -61,6 +61,11 @@ interface DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_CHANGE_PICTURE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_SAVE_GRAPHIC
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/source/ui/app/popup2_tmpl.src b/sd/source/ui/app/popup2_tmpl.src
index e3bcf7f..4fb9404 100644
--- a/sd/source/ui/app/popup2_tmpl.src
+++ b/sd/source/ui/app/popup2_tmpl.src
@@ -649,6 +649,7 @@
         SEPARATOR
         MN_STYLEDT
         SEPARATOR
+        MenuItem { ITEM_CHANGE_PICTURE };
         MenuItem { ITEM_SAVE_GRAPHIC };
         MenuItem { ITEM_COMPRESS_GRAPHIC };
         MenuItem { ITEM_EXTERNAL_EDIT };
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index 227a18f..ab297b7 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -153,6 +153,7 @@ void DrawViewShell::FuTemp01(SfxRequest& rReq)
         }
         break;
 
+        case SID_CHANGE_PICTURE:
         case SID_INSERT_GRAPHIC:
         {
             SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc
index 35a465e..9441328 100644
--- a/svx/inc/globlmn_tmpl.hrc
+++ b/svx/inc/globlmn_tmpl.hrc
@@ -264,6 +264,11 @@
     Command = ".uno:SaveGraphic" ; \
     Text [ en-US ] = "Save Graphic..." ; \
 
+#define ITEM_CHANGE_PICTURE \
+    Identifier = SID_CHANGE_PICTURE ; \
+    Command = ".uno:ChangePicture" ; \
+    Text [ en-US ] = "Change Picture..." ; \
+
 #define ITEM_VIEW_ATTR_ZOOM \
     Identifier = SID_ATTR_ZOOM ; \
     Command = ".uno:Zoom" ; \
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 8d6e56f..2f06246 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -922,11 +922,12 @@
 #define SID_INSERT_FORM_HSCROLL                         (SID_SVX_START+1112)
 #define SID_EXTERNAL_EDIT                               (SID_SVX_START+1113)
 #define SID_ATTR_PAGE_SHARED_FIRST                      (SID_SVX_START+1114)
-#define SID_SAVE_GRAPHIC                                (SID_SVX_START+1115)
-#define SID_COMPRESS_GRAPHIC                            (SID_SVX_START+1116)
-#define SID_FRAME_UP                                    (SID_SVX_START+1117)
-#define SID_FRAME_DOWN                                  (SID_SVX_START+1118)
-#define SID_ATTR_SPECIALCHAR                            (SID_SVX_START+1119)
+#define SID_CHANGE_PICTURE                              (SID_SVX_START+1125)
+#define SID_SAVE_GRAPHIC                                (SID_SVX_START+1116)
+#define SID_COMPRESS_GRAPHIC                            (SID_SVX_START+1117)
+#define SID_FRAME_UP                                    (SID_SVX_START+1118)
+#define SID_FRAME_DOWN                                  (SID_SVX_START+1119)
+#define SID_ATTR_SPECIALCHAR                            (SID_SVX_START+1120)
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
 #define SID_SVX_FIRSTFREE                               (SID_COMPRESS_GRAPHIC + 1)
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 7fa4600..a0b4f85 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5913,6 +5913,30 @@ SfxVoidItem ExternalEdit SID_EXTERNAL_EDIT
     GroupId = GID_GRAPHIC;
 ]
 
+SfxVoidItem ChangePicture SID_CHANGE_PICTURE
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_GRAPHIC;
+]
+
 SfxVoidItem SaveGraphic SID_SAVE_GRAPHIC
 ()
 [
commit 869031d702639852cac51cdb8306ff31420b3f3f
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Dec 4 15:56:38 2012 +0100

    changed behavior of insert picture
    
     - when single graphic object shape is selected, replace the graphic with inserted picture
     - otherwise proceed as before
    
    Change-Id: I767c3ab81abf26c34b612d6aac1f282aa0a53f6c

diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index d7cf3e2..fd72ccc 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -129,8 +129,9 @@ void FuInsertGraphic::DoExecute( SfxRequest&  )
             if( mpViewShell && mpViewShell->ISA(DrawViewShell))
             {
                 sal_Int8    nAction = DND_ACTION_COPY;
-                SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
-                if( pPickObj )
+                SdrObject* pPickObj;
+
+                if( ( pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() ) ) || ( pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC ) ) )
                     nAction = DND_ACTION_LINK;
 
                 Point aPos;
commit 8e3282344a19932e6dd3f919d2ff1be67adce9ed
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Dec 4 15:54:24 2012 +0100

    refactored GetEmptyPresentationObject, added GetSelectedSingleObject
    
     - also extracted part of GetEmptyPresentationObject into new GetPage() method
    
    Change-Id: I3002c3fae8236db1e443f0f454158e7298b56d70

diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 92878af..4755613 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -33,6 +33,7 @@
 #include "smarttag.hxx"
 
 class SdDrawDocument;
+class SdPage;
 class SdrOle2Obj;
 class SdrGrafObj;
 class SdrMediaObj;
@@ -208,6 +209,9 @@ public:
     void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
 
     SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
+    SdPage* GetPage();
+    SdrObject* GetSelectedSingleObject(SdPage* pPage);
+
 protected:
     DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
     DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
diff --git a/sd/source/ui/view/sdview5.cxx b/sd/source/ui/view/sdview5.cxx
index 735aaa2..9023d02 100644
--- a/sd/source/ui/view/sdview5.cxx
+++ b/sd/source/ui/view/sdview5.cxx
@@ -42,57 +42,73 @@ static bool implIsMultiPresObj( PresObjKind eKind )
     }
 }
 
-SdrObject* View::GetEmptyPresentationObject( PresObjKind eKind )
+SdPage* View::GetPage()
 {
-    SdrObject* pEmptyObj = 0;
-
+    SdPage* pPage = NULL;
     SdrPageView*    pPV = GetSdrPageView();
     if( pPV )
     {
-        SdPage* pPage = static_cast< SdPage* >( pPV->GetPage() );
-        if( pPage && !pPage->IsMasterPage() )
+        pPage = static_cast< SdPage* >( pPV->GetPage() );
+    }
+
+    return pPage;
+}
+
+// returns selected object in case there's just one object in the selection
+SdrObject* View::GetSelectedSingleObject(SdPage* pPage)
+{
+    SdrObject* pRet = NULL;
+    if( pPage )
+    {
+        // first try selected shape
+        if ( AreObjectsMarked() )
         {
-            // first try selected shape
-            if ( AreObjectsMarked() )
+            const SdrMarkList& rMarkList = GetMarkedObjectList();
+
+            if (rMarkList.GetMarkCount() == 1)
             {
-                /**********************************************************
-                * Is an empty graphic object available?
-                **********************************************************/
-                const SdrMarkList& rMarkList = GetMarkedObjectList();
+                SdrMark* pMark = rMarkList.GetMark(0);
+                pRet = pMark->GetMarkedSdrObj();
+            }
+        }
+    }
 
-                if (rMarkList.GetMarkCount() == 1)
-                {
-                    SdrMark* pMark = rMarkList.GetMark(0);
-                    SdrObject* pObj = pMark->GetMarkedSdrObj();
+    return pRet;
+}
 
-                    if( pObj->IsEmptyPresObj() && implIsMultiPresObj( pPage->GetPresObjKind(pObj) ) )
-                        pEmptyObj = pObj;
-                }
-            }
+SdrObject* View::GetEmptyPresentationObject( PresObjKind eKind )
+{
+    SdPage* pPage = GetPage();
+    SdrObject* pEmptyObj = NULL;
 
-            // try to find empty pres obj of same type
-            if( !pEmptyObj )
+    if ( pPage && !pPage->IsMasterPage() ) {
+        SdrObject* pObj = GetSelectedSingleObject( pPage );
+
+        if( pObj && pObj->IsEmptyPresObj() && implIsMultiPresObj( pPage->GetPresObjKind(pObj) ) )
+            pEmptyObj = pObj;
+
+        // try to find empty pres obj of same type
+        if( !pEmptyObj )
+        {
+            int nIndex = 1;
+            do
             {
-                int nIndex = 1;
-                do
-                {
-                    pEmptyObj = pPage->GetPresObj(eKind, nIndex++ );
-                }
-                while( (pEmptyObj != 0) && (!pEmptyObj->IsEmptyPresObj()) );
+                pEmptyObj = pPage->GetPresObj(eKind, nIndex++ );
             }
+            while( (pEmptyObj != 0) && (!pEmptyObj->IsEmptyPresObj()) );
+        }
 
-            // last try to find empty pres obj of multiple type
-            if( !pEmptyObj )
-            {
-                const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList();
+        // last try to find empty pres obj of multiple type
+        if( !pEmptyObj )
+        {
+            const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList();
 
-                for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); ++iter )
+            for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); ++iter )
+            {
+                if( (*iter)->IsEmptyPresObj() && implIsMultiPresObj(pPage->GetPresObjKind(*iter)) )
                 {
-                    if( (*iter)->IsEmptyPresObj() && implIsMultiPresObj(pPage->GetPresObjKind(*iter)) )
-                    {
-                        pEmptyObj = (*iter);
-                        break;
-                    }
+                    pEmptyObj = (*iter);
+                    break;
                 }
             }
         }


More information about the Libreoffice-commits mailing list