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

2012-08-01 Thread Noel Power
 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.po...@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:
 voidSetTabBarWidth( long nNewWidth );
 /** Sets a relative tab bar width.
 @param fRelTabBarWidth  Tab bar width relative to frame window width 
(0.0 ... 1.0). */
-voidSetRelTabBarWidth( double fRelTabBarWidth );
+SC_DLLPUBLIC voidSetRelTabBarWidth( 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). */
 voidSetPendingRelTabBarWidth( double fRelTabBarWidth );
 /** Returns the current tab bar width in pixels. */
 longGetTabBarWidth() 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();
+ 

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

2012-04-23 Thread Noel Power
 oovbaapi/ooo/vba/excel/XWorksheets.idl   |1 +
 sc/source/ui/vba/vbaworksheets.cxx   |7 +++
 sc/source/ui/vba/vbaworksheets.hxx   |1 +
 vbahelper/source/vbahelper/vbahelper.cxx |   13 -
 4 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 17c8f6745f9f98013c1b08de8ec03be66546c7fc
Author: Noel Power noel.po...@novell.com
Date:   Mon Apr 23 13:33:15 2012 +0100

support Sheets.PrintPreview bnc#757844

there is still a little wrinkle, the preview shell always shows what sheets 
are selected, it's currently not possible to specify the sheets to preview

diff --git a/oovbaapi/ooo/vba/excel/XWorksheets.idl 
b/oovbaapi/ooo/vba/excel/XWorksheets.idl
index 17c80ce..cca74f9 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheets.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheets.idl
@@ -45,6 +45,7 @@ interface XWorksheets
 void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any 
Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] 
any PrToFileName );
 void Select( [in] any Replace );
 void Copy( [in] any Before, [in] any After);
+void PrintPreview( [in] any EnableChanges );
 };
 }; }; };
 
diff --git a/sc/source/ui/vba/vbaworksheets.cxx 
b/sc/source/ui/vba/vbaworksheets.cxx
index 89f169a..3d218fa 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -537,4 +537,11 @@ bool ScVbaWorksheets::nameExists( uno::Reference 
sheet::XSpreadsheetDocument
 return false;
 }
 
+void ScVbaWorksheets::PrintPreview( const css::uno::Any EnableChanges ) throw 
(css::uno::RuntimeException)
+{
+// need test, print preview current active sheet
+// !! TODO !! get view shell from controller
+PrintPreviewHelper( EnableChanges, excel::getBestViewShell( mxModel ) );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/vba/vbaworksheets.hxx 
b/sc/source/ui/vba/vbaworksheets.hxx
index c34ec08..b184d78 100644
--- a/sc/source/ui/vba/vbaworksheets.hxx
+++ b/sc/source/ui/vba/vbaworksheets.hxx
@@ -73,6 +73,7 @@ public:
 virtual css::uno::Any createCollectionObject( const css::uno::Any aSource 
);
 virtual void SAL_CALL Select( const css::uno::Any Replace ) throw 
(css::uno::RuntimeException);
 virtual void SAL_CALL Copy ( const css::uno::Any Before, const 
css::uno::Any After) throw (css::uno::RuntimeException);
+virtual void SAL_CALL PrintPreview( const css::uno::Any EnableChanges ) 
throw (css::uno::RuntimeException);
 // ScVbaWorksheets_BASE
 virtual css::uno::Any SAL_CALL Item( const css::uno::Any Index1, const 
css::uno::Any Index2 ) throw
 (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx 
b/vbahelper/source/vbahelper/vbahelper.cxx
index b91ef85..0ef22fd 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -473,7 +473,18 @@ void PrintOutHelper( SfxViewShell* pViewShell, const 
uno::Any From, const uno::
 
  void PrintPreviewHelper( const css::uno::Any /*EnableChanges*/, 
SfxViewShell* pViewShell )
 {
-dispatchExecute( pViewShell, SID_VIEWSHELL1 );
+SfxViewFrame* pViewFrame = NULL;
+if ( pViewShell )
+pViewFrame = pViewShell-GetViewFrame();
+if ( pViewFrame )
+{
+if ( !pViewFrame-GetFrame().IsInPlace() )
+{
+dispatchExecute( pViewShell, SID_VIEWSHELL1 );
+while ( isInPrintPreview( pViewFrame ) )
+Application::Yield();
+}
+}
 }
 
 bool extractBoolFromAny( const uno::Any rAny ) throw (uno::RuntimeException)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits