[Libreoffice-commits] .: oovbaapi/ooo sc/source

Noel Power noelp at kemper.freedesktop.org
Wed Aug 1 10:48:45 PDT 2012


 oovbaapi/ooo/vba/excel/XWindow.idl |    1 +
 sc/source/ui/drawfunc/fusel.cxx    |   17 ++++++++++-------
 sc/source/ui/inc/tabview.hxx       |    4 ++--
 sc/source/ui/vba/vbawindow.cxx     |   22 ++++++++++++++++++++++
 sc/source/ui/vba/vbawindow.hxx     |    2 ++
 5 files changed, 37 insertions(+), 9 deletions(-)

New commits:
commit 3514df0f78c6cce2cc618e1c7c2728c759342bce
Author: Noel Power <noel.power at novell.com>
Date:   Wed Aug 1 18:25:32 2012 +0100

    add TabRatio api and detect macro at group shape fixes bnc#770708
    
    Change-Id: I73eb612edaba21aa5bb07577b42bd31f8de2dd2a

diff --git a/oovbaapi/ooo/vba/excel/XWindow.idl b/oovbaapi/ooo/vba/excel/XWindow.idl
index 660ca65..f685a8b 100644
--- a/oovbaapi/ooo/vba/excel/XWindow.idl
+++ b/oovbaapi/ooo/vba/excel/XWindow.idl
@@ -51,6 +51,7 @@ interface XWindow : com::sun::star::uno::XInterface
     [attribute, readonly] XRange VisibleRange;
     [attribute] any WindowState;
     [attribute] any Zoom;
+    [attribute] double TabRatio;
     any SelectedSheets( [in] any Index );
     void SmallScroll( [in] any Down, [in] any Up, [in] any ToRight, [in] any ToLeft );
     void LargeScroll( [in] any Down, [in] any Up, [in] any ToRight, [in] any ToLeft );
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index d9fedb4..7665bf6 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -186,19 +186,22 @@ sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
                    // associated with the clicked object is used only
 
                    // additionally you can also select a macro in Excel for a grouped
-                   // objects and this results in the macro being set for the elements
-                   // in the group and no macro is exported for the group
-
+                   // objects and this *usually* results in the macro being set
+                   // for the elements in the group and no macro is exported
+                   // for the group itself ( this however is not always true )
                    // if a macro and hlink are defined favour the hlink
-
                    // If a group object has no hyperlink use the hyperlink of the
                    // object clicked
 
                    if ( pObj->IsGroupObject() )
                    {
-                       SdrObject* pHit = NULL;
-                       if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
-                           pObj = pHit;
+                       ScMacroInfo* pTmpInfo = ScDrawLayer::GetMacroInfo( pObj );
+                       if ( !pTmpInfo || pTmpInfo->GetMacro().isEmpty() )
+                       {
+                           SdrObject* pHit = NULL;
+                           if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
+                               pObj = pHit;
+                       }
                    }
 
                    ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, true );
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index aadadc9..5a3e35b 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -255,14 +255,14 @@ public:
     void            SetTabBarWidth( long nNewWidth );
     /** Sets a relative tab bar width.
         @param fRelTabBarWidth  Tab bar width relative to frame window width (0.0 ... 1.0). */
-    void            SetRelTabBarWidth( double fRelTabBarWidth );
+    SC_DLLPUBLIC void            SetRelTabBarWidth( double fRelTabBarWidth );
     /** Sets a relative tab bar width. Tab bar is resized again in next DoResize().
         @param fRelTabBarWidth  Tab bar width relative to frame window width (0.0 ... 1.0). */
     void            SetPendingRelTabBarWidth( double fRelTabBarWidth );
     /** Returns the current tab bar width in pixels. */
     long            GetTabBarWidth() const;
     /** Returns the current tab bar width relative to the frame window width (0.0 ... 1.0). */
-    double          GetRelTabBarWidth() const;
+    SC_DLLPUBLIC double          GetRelTabBarWidth() const;
     /** Returns the pending tab bar width relative to the frame window width (0.0 ... 1.0). */
     double          GetPendingRelTabBarWidth() const;
 
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index f196a5c..f56c79f 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -851,6 +851,28 @@ ScVbaWindow::PrintPreview( const css::uno::Any& EnableChanges ) throw (css::scri
     PrintPreviewHelper( EnableChanges, excel::getBestViewShell( m_xModel ) );
 }
 
+double SAL_CALL ScVbaWindow::getTabRatio() throw (css::uno::RuntimeException)
+{
+    ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
+    if ( pViewShell && pViewShell->GetViewData() && pViewShell->GetViewData()->GetView() )
+    {
+        double fRatio = pViewShell->GetViewData()->GetView()->GetRelTabBarWidth();
+        if ( fRatio >= 0.0 && fRatio <= 1.0 )
+            return fRatio;
+    }
+    return 0.0;
+}
+
+void SAL_CALL ScVbaWindow::setTabRatio( double fRatio ) throw (css::uno::RuntimeException)
+{
+    ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
+    if ( pViewShell && pViewShell->GetViewData() && pViewShell->GetViewData()->GetView() )
+    {
+        if ( fRatio >= 0.0 && fRatio <= 1.0 )
+            pViewShell->GetViewData()->GetView()->SetRelTabBarWidth( fRatio );
+    }
+}
+
 rtl::OUString
 ScVbaWindow::getServiceImplName()
 {
diff --git a/sc/source/ui/vba/vbawindow.hxx b/sc/source/ui/vba/vbawindow.hxx
index 12b460a..f3d2d50 100644
--- a/sc/source/ui/vba/vbawindow.hxx
+++ b/sc/source/ui/vba/vbawindow.hxx
@@ -112,6 +112,8 @@ public:
     virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
     virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException);
     virtual void SAL_CALL setZoom( const css::uno::Any& _zoom ) throw (css::uno::RuntimeException);
+    virtual double SAL_CALL getTabRatio() throw (css::uno::RuntimeException) ;
+    virtual void SAL_CALL setTabRatio( double _tabratio ) throw (css::uno::RuntimeException) ;
 
     // Methods
     virtual void SAL_CALL SmallScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException);


More information about the Libreoffice-commits mailing list