[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2023-02-24 Thread Justin Luth (via logerrit)
 oovbaapi/ooo/vba/word/XDocument.idl |1 +
 sw/source/ui/vba/vbadocument.cxx|8 
 sw/source/ui/vba/vbadocument.hxx|1 +
 3 files changed, 10 insertions(+)

New commits:
commit d6f3715190494b55e2ecc105cbd6e5ddeff47f0c
Author: Justin Luth 
AuthorDate: Fri Feb 24 12:45:35 2023 -0500
Commit: Justin Luth 
CommitDate: Fri Feb 24 21:55:40 2023 +

word vba: Add activeWindow to XDocument

This allows ActiveDocument.ActiveWindow.*

It already works as a global, and as Aplication.ActiveWindow

Unit test will follow when some of the * items are added.

Change-Id: I7fb18df9f6259ec4b9d60516b2da704098831dfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147665
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oovbaapi/ooo/vba/word/XDocument.idl 
b/oovbaapi/ooo/vba/word/XDocument.idl
index 354cac11b2ed..99bdd5249a6a 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -25,6 +25,7 @@ interface XDocument
 interface XConnectable;
 
 [attribute, readonly] XRange Content;
+[attribute, readonly] XWindow ActiveWindow;
 [attribute] any AttachedTemplate;
 [attribute] long ProtectionType;
 [attribute] boolean UpdateStylesOnOpen;
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 52907477dcff..caf520c3433a 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -30,6 +30,7 @@
 #include "vbabookmarks.hxx"
 #include "vbamailmerge.hxx"
 #include "vbavariables.hxx"
+#include "vbawindow.hxx"
 #include 
 #include 
 #include 
@@ -245,6 +246,13 @@ uno::Any SAL_CALL 
SwVbaDocument::SelectContentControlsByTitle(const uno::Any& in
 new SwVbaContentControls(this, mxContext, 
mxTextDocument, "", sTitle)));
 }
 
+uno::Reference SwVbaDocument::getActiveWindow()
+{
+// copied from vbaappliction which has a #FIXME so far can't determine 
Parent
+return new SwVbaWindow(uno::Reference< XHelperInterface >(), mxContext, 
mxModel,
+   mxModel->getCurrentController());
+}
+
 uno::Any SAL_CALL
 SwVbaDocument::Variables( const uno::Any& rIndex )
 {
diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx
index 31ca3751686a..069215513cc5 100644
--- a/sw/source/ui/vba/vbadocument.hxx
+++ b/sw/source/ui/vba/vbadocument.hxx
@@ -58,6 +58,7 @@ public:
 css::uno::Any SAL_CALL ContentControls(const css::uno::Any& index) 
override;
 css::uno::Any SAL_CALL SelectContentControlsByTag(const css::uno::Any& 
index) override;
 css::uno::Any SAL_CALL SelectContentControlsByTitle(const css::uno::Any& 
index) override;
+css::uno::Reference SAL_CALL getActiveWindow() override;
 virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) 
override;
 virtual css::uno::Any SAL_CALL getAttachedTemplate() override;
 virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& 
_attachedtemplate ) override;


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-10-13 Thread Justin Luth (via logerrit)
 oovbaapi/ooo/vba/word/XGlobals.idl |1 +
 sw/source/ui/vba/vbaglobals.cxx|9 +
 sw/source/ui/vba/vbaglobals.hxx|1 +
 3 files changed, 11 insertions(+)

New commits:
commit 3aebb45d18116926dc8edb268c205c6f4ff06f05
Author: Justin Luth 
AuthorDate: Mon Oct 10 20:40:30 2022 -0400
Commit: Miklos Vajna 
CommitDate: Thu Oct 13 09:03:27 2022 +0200

sw vba: tie WordBasic to VBAGlobals

This allows WordBasic to also be run directly,
instead of only working with Application.WordBasic.*.

Change-Id: I60c3beaa1fce9a8bf25786cc0b2ed6ef6deda2f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141200
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl 
b/oovbaapi/ooo/vba/word/XGlobals.idl
index 8d2ee3900fcc..0e16bcb08d4e 100644
--- a/oovbaapi/ooo/vba/word/XGlobals.idl
+++ b/oovbaapi/ooo/vba/word/XGlobals.idl
@@ -31,6 +31,7 @@ interface XGlobals : com::sun::star::uno::XInterface
 [attribute, readonly] ooo::vba::word::XSystem System;
 [attribute, readonly] ooo::vba::word::XOptions Options;
 [attribute, readonly] ooo::vba::word::XSelection Selection;
+[attribute, readonly] ooo::vba::word::XWordBasic WordBasic;
 any CommandBars( [in] any Index );
 any Documents( [in] any Index );
 any Addins( [in] any Index );
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index f1c948c6cb5f..a319a4aea13d 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include "vbaglobals.hxx"
+#include "vbawordbasic.hxx"
 #include 
 
 #include 
@@ -126,6 +127,14 @@ SwVbaGlobals::getSelection()
 return getApplication()->getSelection();
 }
 
+uno::Reference SAL_CALL SwVbaGlobals::getWordBasic()
+{
+assert(dynamic_cast(getApplication().get()));
+SwVbaApplication* pVbaApp = 
static_cast(getApplication().get());
+uno::Reference xWB(new SwWordBasic(pVbaApp));
+return xWB;
+}
+
 float SAL_CALL SwVbaGlobals::CentimetersToPoints( float Centimeters )
 {
 return getApplication()->CentimetersToPoints( Centimeters );
diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx
index af26f1b6256d..72f4ca07829c 100644
--- a/sw/source/ui/vba/vbaglobals.hxx
+++ b/sw/source/ui/vba/vbaglobals.hxx
@@ -50,6 +50,7 @@ public:
 virtual css::uno::Reference SAL_CALL getActiveWindow() 
override;
 virtual css::uno::Reference SAL_CALL 
getOptions() override;
 virtual css::uno::Reference SAL_CALL 
getSelection() override;
+virtual css::uno::Reference SAL_CALL 
getWordBasic() override;
 virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any& aIndex) 
override;
 virtual css::uno::Any SAL_CALL Documents(const css::uno::Any& aIndex) 
override;
 virtual css::uno::Any SAL_CALL Addins(const css::uno::Any& aIndex) 
override;


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-08-06 Thread Hannah Meeks (via logerrit)
 oovbaapi/ooo/vba/word/XGlobals.idl |9 +++
 sw/source/ui/vba/vbaglobals.cxx|   45 +
 sw/source/ui/vba/vbaglobals.hxx|   10 
 3 files changed, 64 insertions(+)

New commits:
commit 5fecf10b9ef6e76aa1d06b7ab350abb5a495dda0
Author: Hannah Meeks 
AuthorDate: Fri Aug 5 10:48:50 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Aug 6 14:16:50 2022 +0200

VBA Add conversion methods to global

Change-Id: I920799321f245c015a527c816272c1038cc04544
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137851
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl 
b/oovbaapi/ooo/vba/word/XGlobals.idl
index 9808187a0d9f..8d2ee3900fcc 100644
--- a/oovbaapi/ooo/vba/word/XGlobals.idl
+++ b/oovbaapi/ooo/vba/word/XGlobals.idl
@@ -37,6 +37,15 @@ interface XGlobals : com::sun::star::uno::XInterface
 any Dialogs( [in] any Index );
 any ListGalleries( [in] any aIndex );
 float CentimetersToPoints([in] float Centimeters );
+float PointsToCentimeters( [in] float Points);
+float PixelsToPoints( [in] float Pixels, [in] boolean fVertical );
+float PointsToPixels( [in] float Points, [in] boolean fVertical);
+float InchesToPoints( [in] float Inches);
+float PointsToInches( [in] float Points);
+float MillimetersToPoints( [in] float Millimeters );
+float PointsToMillimeters( [in] float Points);
+float PicasToPoints( [in] float Picas);
+float PointsToPicas( [in] float Points);
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index 0e5db3802895..6492b2628d59 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -129,6 +129,51 @@ float SAL_CALL SwVbaGlobals::CentimetersToPoints( float 
Centimeters )
 return getApplication()->CentimetersToPoints( Centimeters );
 }
 
+float SAL_CALL SwVbaGlobals::PointsToCentimeters( float Points )
+{
+return getApplication()->PointsToCentimeters( Points );
+}
+
+float SAL_CALL SwVbaGlobals::PixelsToPoints( float Pixels, ::sal_Bool 
fVertical )
+{
+return getApplication()->PixelsToPoints( Pixels, fVertical );
+}
+
+float SAL_CALL SwVbaGlobals::PointsToPixels( float Points, ::sal_Bool 
fVertical )
+{
+return getApplication()->PointsToPixels( Points, fVertical );
+}
+
+float SAL_CALL SwVbaGlobals::InchesToPoints( float Inches )
+{
+return getApplication()->InchesToPoints( Inches );
+}
+
+float SAL_CALL SwVbaGlobals::PointsToInches( float Points )
+{
+return getApplication()->PointsToInches( Points );
+}
+
+float SAL_CALL SwVbaGlobals::MillimetersToPoints( float Millimeters )
+{
+return getApplication()->MillimetersToPoints( Millimeters );
+}
+
+float SAL_CALL SwVbaGlobals::PointsToMillimeters( float Points )
+{
+return getApplication()->PointsToMillimeters( Points );
+}
+
+float SAL_CALL SwVbaGlobals::PicasToPoints( float Picas )
+{
+return getApplication()->PicasToPoints( Picas );
+}
+
+float SAL_CALL SwVbaGlobals::PointsToPicas( float Points )
+{
+return getApplication()->PointsToPicas( Points );
+}
+
 OUString
 SwVbaGlobals::getServiceImplName()
 {
diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx
index 1d8c0b4f8a2a..af26f1b6256d 100644
--- a/sw/source/ui/vba/vbaglobals.hxx
+++ b/sw/source/ui/vba/vbaglobals.hxx
@@ -56,6 +56,16 @@ public:
 virtual css::uno::Any SAL_CALL Dialogs(const css::uno::Any& aIndex) 
override;
 virtual css::uno::Any SAL_CALL ListGalleries(const css::uno::Any& aIndex) 
override;
 virtual float SAL_CALL CentimetersToPoints(float Centimeters) override;
+virtual float SAL_CALL PointsToCentimeters(float Points) override;
+virtual float SAL_CALL PixelsToPoints(float Pixels, ::sal_Bool fVertical) 
override;
+virtual float SAL_CALL PointsToPixels(float Pixels, ::sal_Bool fVertical) 
override;
+virtual float SAL_CALL InchesToPoints(float Inches) override;
+virtual float SAL_CALL PointsToInches(float Points) override;
+virtual float SAL_CALL MillimetersToPoints(float Millimeters) override;
+virtual float SAL_CALL PointsToMillimeters(float Points) override;
+virtual float SAL_CALL PicasToPoints(float Picas) override;
+virtual float SAL_CALL PointsToPicas(float Points) override;
+
 // XMultiServiceFactory
 virtual css::uno::Sequence SAL_CALL getAvailableServiceNames() 
override;
 


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-08-05 Thread Hannah Meeks (via logerrit)
 oovbaapi/ooo/vba/word/XApplication.idl |   11 +
 sw/source/ui/vba/vbaapplication.cxx|   61 -
 sw/source/ui/vba/vbaapplication.hxx|   12 ++
 3 files changed, 82 insertions(+), 2 deletions(-)

New commits:
commit c9b57b7226de7062b9feaf7706825f6dc2a6fee8
Author: Hannah Meeks 
AuthorDate: Thu Aug 4 09:45:22 2022 +0100
Commit: Michael Meeks 
CommitDate: Fri Aug 5 12:06:59 2022 +0200

VBA Add conversion methods to Application

Change-Id: Ic0de06699a647565deca7985742965a72614df16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137787
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Michael Meeks 

diff --git a/oovbaapi/ooo/vba/word/XApplication.idl 
b/oovbaapi/ooo/vba/word/XApplication.idl
index 257903eb47f2..0475c2d82829 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -52,7 +52,16 @@ interface XApplication : XConnectable
 any Addins( [in] any Index );
 any Dialogs( [in] any Index );
 any ListGalleries( [in] any aIndex );
-float CentimetersToPoints([in] float Centimeters );
+float CentimetersToPoints( [in] float Centimeters );
+float PointsToCentimeters( [in] float Points);
+float PixelsToPoints( [in] float Pixels, [in] boolean fVertical );
+float PointsToPixels( [in] float Points, [in] boolean fVertical);
+float InchesToPoints( [in] float Inches);
+float PointsToInches( [in] float Points);
+float MillimetersToPoints( [in] float Millimeters );
+float PointsToMillimeters( [in] float Points);
+float PicasToPoints( [in] float Picas);
+float PointsToPicas( [in] float Points);
 void ShowMe();
 void Resize( [in] long Width, [in] long Height );
 void Move( [in] long Left, [in] long Top );
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 1cab0573121a..c95c855c01fd 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "vbaapplication.hxx"
 #include "vbadocument.hxx"
@@ -417,9 +418,67 @@ float SAL_CALL SwVbaApplication::CentimetersToPoints( 
float Centimeters )
 return VbaApplicationBase::CentimetersToPoints( Centimeters );
 }
 
+float SAL_CALL SwVbaApplication::PointsToCentimeters( float Points )
+{
+return o3tl::convert(Points, o3tl::Length::pt, o3tl::Length::cm);
+}
+
+float SAL_CALL SwVbaApplication::PixelsToPoints( float Pixels, ::sal_Bool 
fVertical )
+{
+//Set up xDevice
+uno::Reference< frame::XModel > xModel( getCurrentDocument(), 
uno::UNO_SET_THROW );
+uno::Reference< frame::XController > xController( 
xModel->getCurrentController(), uno::UNO_SET_THROW );
+uno::Reference< frame::XFrame > xFrame( xController->getFrame(), 
uno::UNO_SET_THROW );
+uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), 
uno::UNO_SET_THROW );
+css::uno::Reference< css::awt::XDevice > xDevice( xWindow, 
css::uno::UNO_QUERY );
+
+return ooo::vba::PixelsToPoints(xDevice, Pixels, fVertical);
+}
+
+float SAL_CALL SwVbaApplication::PointsToPixels( float Pixels, ::sal_Bool 
fVertical )
+{
+uno::Reference< frame::XModel > xModel( getCurrentDocument(), 
uno::UNO_SET_THROW );
+uno::Reference< frame::XController > xController( 
xModel->getCurrentController(), uno::UNO_SET_THROW );
+uno::Reference< frame::XFrame > xFrame( xController->getFrame(), 
uno::UNO_SET_THROW );
+uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), 
uno::UNO_SET_THROW );
+css::uno::Reference< css::awt::XDevice > xDevice( xWindow, 
css::uno::UNO_QUERY );
+
+return ooo::vba::PointsToPixels(xDevice, Pixels, fVertical);
+}
+
+float SAL_CALL SwVbaApplication::InchesToPoints( float Inches )
+{
+return o3tl::convert(Inches, o3tl::Length::ch, o3tl::Length::pt);
+}
+
+float SAL_CALL SwVbaApplication::PointsToInches( float Points )
+{
+return o3tl::convert(Points, o3tl::Length::pt, o3tl::Length::ch);
+}
+
+float SAL_CALL SwVbaApplication::MillimetersToPoints( float Millimeters )
+{
+return o3tl::convert(Millimeters, o3tl::Length::mm, o3tl::Length::pt);
+}
+
+float SAL_CALL SwVbaApplication::PointsToMillimeters( float Points )
+{
+return o3tl::convert(Points, o3tl::Length::pt, o3tl::Length::mm);
+}
+
+float SAL_CALL SwVbaApplication::PicasToPoints( float Picas )
+{
+return o3tl::convert(Picas, o3tl::Length::pc, o3tl::Length::pt);
+}
+
+float SAL_CALL SwVbaApplication::PointsToPicas( float Points )
+{
+return o3tl::convert(Points, o3tl::Length::pt, o3tl::Length::pc);
+}
+
 void SAL_CALL SwVbaApplication::ShowMe()
 {
-// No idea what we should or could do
+// Method no longer supported in word - deprecated
 }
 
 void SAL_CALL SwVbaApplication::Resize( sal_Int32 Width, sal_Int32 Height )
diff --git a/sw/source/ui/vba/vbaapplication.hxx 
b/sw/source/ui/vba/vbaapplication.hxx
index 43cf30bc1a20..9

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-07-20 Thread Hannah Meeks (via logerrit)
 oovbaapi/ooo/vba/word/XDocument.idl |1 +
 sw/source/ui/vba/vbadocument.cxx|8 
 sw/source/ui/vba/vbadocument.hxx|1 +
 3 files changed, 10 insertions(+)

New commits:
commit 4a49644c97c0f2c3e14a931592f28044a8596425
Author: Hannah Meeks 
AuthorDate: Fri Jul 15 18:55:41 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jul 20 14:46:37 2022 +0200

VBA: Add Select Method to ActiveDocument

Change-Id: I0d8d02c555fd113b96661085b339b12d83c6010f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137109
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oovbaapi/ooo/vba/word/XDocument.idl 
b/oovbaapi/ooo/vba/word/XDocument.idl
index d9717a7eea0c..0f7b5f994aa1 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -43,6 +43,7 @@ interface XDocument
 any Tables( [in] any Index );
 any Fields( [in] any Index );
 any Shapes( [in] any Index );
+void Select();
 any Sections( [in] any Index );
 void Activate();
 any PageSetup();
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 92251ef36da2..4a1a8dd8a2ae 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -255,6 +255,14 @@ SwVbaDocument::Shapes( const uno::Any& index )
 return uno::Any( xCol );
 }
 
+void SAL_CALL
+SwVbaDocument::Select()
+{
+auto xRange = getContent();
+if ( xRange )
+xRange->Select();
+}
+
 uno::Any SAL_CALL
 SwVbaDocument::Sections( const uno::Any& index )
 {
diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx
index 0d213690a982..f1352e44f625 100644
--- a/sw/source/ui/vba/vbadocument.hxx
+++ b/sw/source/ui/vba/vbadocument.hxx
@@ -63,6 +63,7 @@ public:
 virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) 
override;
 virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) 
override;
 virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) 
override;
+virtual void SAL_CALL Select() override;
 virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) 
override;
 virtual void SAL_CALL Activate() override;
 virtual css::uno::Any SAL_CALL PageSetup() override;


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-07-14 Thread Hannah Meeks (via logerrit)
 oovbaapi/ooo/vba/word/XRange.idl |2 ++
 sw/source/ui/vba/vbarange.hxx|4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit febfbaff07562dd68bc2b5bc870699754f763e50
Author: Hannah Meeks 
AuthorDate: Tue Jul 12 17:15:17 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 14 10:19:57 2022 +0200

The DefaultPropertyName for range is tex

Change-Id: I0e5f1ae0757a2ad8f58f011df435c30c577d8a79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137006
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oovbaapi/ooo/vba/word/XRange.idl b/oovbaapi/ooo/vba/word/XRange.idl
index ea5e05d2a497..3b51db78ca3e 100644
--- a/oovbaapi/ooo/vba/word/XRange.idl
+++ b/oovbaapi/ooo/vba/word/XRange.idl
@@ -28,6 +28,8 @@ interface XListFormat;
 interface XRange
 {
 interface ooo::vba::XHelperInterface;
+interface com::sun::star::script::XDefaultProperty;
+
 
 [attribute] string Text;
 [attribute] XParagraphFormat ParagraphFormat;
diff --git a/sw/source/ui/vba/vbarange.hxx b/sw/source/ui/vba/vbarange.hxx
index 38e2631e40fe..ee8ed621bb8c 100644
--- a/sw/source/ui/vba/vbarange.hxx
+++ b/sw/source/ui/vba/vbarange.hxx
@@ -67,11 +67,13 @@ public:
 virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< 
ooo::vba::word::XParagraphFormat >& rParagraphFormat ) override;
 virtual css::uno::Any SAL_CALL getStyle() override;
 virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) override;
-
 virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() 
override;
 virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() 
override;
 virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL 
getListFormat() override;
 
+//XDefaultProperty
+virtual OUString SAL_CALL getDefaultPropertyName() override { return 
"Text"; }
+
 // Methods
 virtual void SAL_CALL InsertBreak(const css::uno::Any& _breakType) 
override;
 virtual void SAL_CALL Select() override;


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2022-07-14 Thread Hannah Meeks (via logerrit)
 oovbaapi/ooo/vba/word/XRange.idl |3 +++
 sw/source/ui/vba/vbarange.cxx|9 +
 sw/source/ui/vba/vbarange.hxx|3 +++
 3 files changed, 15 insertions(+)

New commits:
commit 0b5df6634a2021986b0de2ab12a41c0d4af4f60c
Author: Hannah Meeks 
AuthorDate: Tue Jul 12 15:47:03 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 14 10:19:31 2022 +0200

tdf#149963 -  XFind not a property/attribute of XRange

Updated XRange to include XFind

Change-Id: If9570fbb5de8d14063a72a4c4c55fcfd491dd496
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137004
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/oovbaapi/ooo/vba/word/XRange.idl b/oovbaapi/ooo/vba/word/XRange.idl
index fa0bf5e6d718..ea5e05d2a497 100644
--- a/oovbaapi/ooo/vba/word/XRange.idl
+++ b/oovbaapi/ooo/vba/word/XRange.idl
@@ -23,6 +23,7 @@ module ooo {  module vba {  module word {
 interface XParagraphFormat;
 interface XStyle;
 interface XFont;
+interface XFind;
 interface XListFormat;
 interface XRange
 {
@@ -35,6 +36,8 @@ interface XRange
 // Of course Font is NOT readonly, #FIXME #TODO
 // readonly though will force an error attempting to write
 [attribute, readonly] XFont Font;
+[attribute, readonly] XFind Find;
+
 [attribute] long LanguageID;
 [attribute] long Start;
 [attribute] long End;
diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx
index eaa7cac51c3b..8803b067316b 100644
--- a/sw/source/ui/vba/vbarange.cxx
+++ b/sw/source/ui/vba/vbarange.cxx
@@ -29,6 +29,7 @@
 #include "vbaparagraphformat.hxx"
 #include "vbastyle.hxx"
 #include "vbafont.hxx"
+#include "vbafind.hxx"
 #include "vbapalette.hxx"
 #include "vbapagesetup.hxx"
 #include "vbalistformat.hxx"
@@ -297,6 +298,14 @@ SwVbaRange::getFont()
 return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), 
uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) 
);
 }
 
+uno::Reference< word::XFind > SAL_CALL
+SwVbaRange::getFind()
+{
+uno::Reference< text::XTextRange > xTextRange = getXTextRange();
+uno::Reference< frame::XModel > xModel( mxTextDocument, 
uno::UNO_QUERY_THROW );
+return SwVbaFind::GetOrCreateFind(this, mxContext, xModel, xTextRange);
+}
+
 uno::Reference< word::XListFormat > SAL_CALL
 SwVbaRange::getListFormat()
 {
diff --git a/sw/source/ui/vba/vbarange.hxx b/sw/source/ui/vba/vbarange.hxx
index d311c25a70c9..38e2631e40fe 100644
--- a/sw/source/ui/vba/vbarange.hxx
+++ b/sw/source/ui/vba/vbarange.hxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,7 +69,9 @@ public:
 virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) override;
 
 virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() 
override;
+virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() 
override;
 virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL 
getListFormat() override;
+
 // Methods
 virtual void SAL_CALL InsertBreak(const css::uno::Any& _breakType) 
override;
 virtual void SAL_CALL Select() override;


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-11-26 Thread Tor Lillqvist (via logerrit)
 oovbaapi/ooo/vba/word/XDocument.idl |1 +
 sw/source/ui/vba/vbadocument.cxx|6 ++
 sw/source/ui/vba/vbadocument.hxx|1 +
 3 files changed, 8 insertions(+)

New commits:
commit 939331c0935d671984079051fda03feb3dcf23d9
Author: Tor Lillqvist 
AuthorDate: Wed Oct 23 12:12:25 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Tue Nov 26 12:30:19 2019 +0200

Add ooo.vba.word.XDocument.Close() method and implement

Will be needed in COLEAT. And seems like a fairly obviously missing
API otherwise, too.

Change-Id: I990c605a7e3f9cff3b72f20a626477d010da9852
Reviewed-on: https://gerrit.libreoffice.org/81369
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
(cherry picked from commit b0b0788ba040be2bf42aa19313759ba9f4811d38)
Reviewed-on: https://gerrit.libreoffice.org/83660
(cherry picked from commit 1562900446a99623a30fa9e719322a8c24132f9d)

diff --git a/oovbaapi/ooo/vba/word/XDocument.idl 
b/oovbaapi/ooo/vba/word/XDocument.idl
index 63e4535e9075..80cbfe977d78 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -63,6 +63,7 @@ interface XDocument
 any Frames( [in] any index );
 void SaveAs2000( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter 
);
 void SaveAs( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter, 
[in] any Encoding, [in] any InsertLineBreaks, [in] any AllowSubstitutions, [in] 
any LineEnding, [in] any AddBiDiMarks );
+void Close( [in] any SaveChanges, [in] any OriginalFormat, [in] any 
RouteDocument );
 // This is a COLEAT-specific addition
 void SavePreviewPngAs( [in] any FileName );
 };
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 0883afe12374..c49adef7fad0 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -525,6 +525,12 @@ SwVbaDocument::SaveAs( const uno::Any& FileName, const 
uno::Any& FileFormat, con
 }
 
 void SAL_CALL
+SwVbaDocument::Close( const uno::Any& SaveChanges, const uno::Any& 
/*OriginalFormat*/, const uno::Any& /*RouteDocument*/ )
+{
+VbaDocumentBase::Close( SaveChanges, uno::Any(), uno::Any() );
+}
+
+void SAL_CALL
 SwVbaDocument::SavePreviewPngAs( const uno::Any& FileName )
 {
 OUString sFileName;
diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx
index e8f7a311ae3f..a5e4dabf8452 100644
--- a/sw/source/ui/vba/vbadocument.hxx
+++ b/sw/source/ui/vba/vbadocument.hxx
@@ -89,6 +89,7 @@ public:
 virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) 
override;
 virtual void SAL_CALL SaveAs2000( const css::uno::Any& FileName, const 
css::uno::Any& FileFormat, const css::uno::Any& LockComments, const 
css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const 
css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const 
css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& 
SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const 
css::uno::Any& SaveAsAOCELetter ) override;
 virtual void SAL_CALL SaveAs( const css::uno::Any& FileName, const 
css::uno::Any& FileFormat, const css::uno::Any& LockComments, const 
css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const 
css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const 
css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& 
SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const 
css::uno::Any& SaveAsAOCELetter, const css::uno::Any& Encoding, const 
css::uno::Any& InsertLineBreaks, const css::uno::Any& AllowSubstitutions, const 
css::uno::Any& LineEnding, const css::uno::Any& AddBiDiMarks ) override;
+virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const 
css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) override;
 virtual void SAL_CALL SavePreviewPngAs( const css::uno::Any& FileName ) 
override;
 
 // XInvocation
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-05-22 Thread Tor Lillqvist (via logerrit)
 oovbaapi/ooo/vba/word/XDocument.idl |3 ++-
 sw/source/ui/vba/vbadocument.cxx|   16 
 sw/source/ui/vba/vbadocument.hxx|1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 23aff73f167c898238f2d1b8f6f6d5b42b699f02
Author: Tor Lillqvist 
AuthorDate: Wed May 22 19:30:37 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Thu May 23 08:12:27 2019 +0200

Add ooo.vba.word.XDocument.SavePreviewPngAs() and implement

This is for COLEAT's internal use.

Change-Id: If1ac2a5b251129e4431d3c0bde82529d6bdc7ccc
Reviewed-on: https://gerrit.libreoffice.org/72809
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XDocument.idl 
b/oovbaapi/ooo/vba/word/XDocument.idl
index 888287b34e1b..63e4535e9075 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -63,7 +63,8 @@ interface XDocument
 any Frames( [in] any index );
 void SaveAs2000( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter 
);
 void SaveAs( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter, 
[in] any Encoding, [in] any InsertLineBreaks, [in] any AllowSubstitutions, [in] 
any LineEnding, [in] any AddBiDiMarks );
-
+// This is a COLEAT-specific addition
+void SavePreviewPngAs( [in] any FileName );
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 7c649ec75552..3c078546bdc8 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -518,6 +518,22 @@ SwVbaDocument::SaveAs( const uno::Any& FileName, const 
uno::Any& FileFormat, con
 return SaveAs2000( FileName, FileFormat, LockComments, Password, 
AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, 
SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter );
 }
 
+void SAL_CALL
+SwVbaDocument::SavePreviewPngAs( const uno::Any& FileName )
+{
+OUString sFileName;
+FileName >>= sFileName;
+OUString sURL;
+osl::FileBase::getFileURLFromSystemPath( sFileName, sURL );
+
+uno::Sequence<  beans::PropertyValue > storeProps(1);
+storeProps[0].Name = "FilterName" ;
+storeProps[0].Value <<= OUString("writer_png_Export");
+
+uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW 
);
+xStor->storeToURL( sURL, storeProps );
+}
+
 uno::Any
 SwVbaDocument::getControlShape( const OUString& sName )
 {
diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx
index 1acb42e9232f..af4c93f32f95 100644
--- a/sw/source/ui/vba/vbadocument.hxx
+++ b/sw/source/ui/vba/vbadocument.hxx
@@ -90,6 +90,7 @@ public:
 virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) 
override;
 virtual void SAL_CALL SaveAs2000( const css::uno::Any& FileName, const 
css::uno::Any& FileFormat, const css::uno::Any& LockComments, const 
css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const 
css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const 
css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& 
SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const 
css::uno::Any& SaveAsAOCELetter ) override;
 virtual void SAL_CALL SaveAs( const css::uno::Any& FileName, const 
css::uno::Any& FileFormat, const css::uno::Any& LockComments, const 
css::uno::Any& Password, const css::uno::Any& AddToRecentFiles, const 
css::uno::Any& WritePassword, const css::uno::Any& ReadOnlyRecommended, const 
css::uno::Any& EmbedTrueTypeFonts, const css::uno::Any& 
SaveNativePictureFormat, const css::uno::Any& SaveFormsData, const 
css::uno::Any& SaveAsAOCELetter, const css::uno::Any& Encoding, const 
css::uno::Any& InsertLineBreaks, const css::uno::Any& AllowSubstitutions, const 
css::uno::Any& LineEnding, const css::uno::Any& AddBiDiMarks ) override;
+virtual void SAL_CALL SavePreviewPngAs( const css::uno::Any& FileName ) 
override;
 
 // XInvocation
 virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL 
getIntrospection(  ) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-04-19 Thread Tor Lillqvist (via logerrit)
 oovbaapi/ooo/vba/word/XWordBasic.idl  |1 
 sw/source/ui/vba/vbaapplication.cxx   |   88 ++
 sw/source/ui/vba/vbadocument.cxx  |   48 --
 sw/source/ui/vba/vbafilterpropsfromformat.hxx |   76 ++
 4 files changed, 166 insertions(+), 47 deletions(-)

New commits:
commit 2a6450cbe8b57cae240d8cfea02e508cfac78dbe
Author: Tor Lillqvist 
AuthorDate: Fri Apr 19 11:47:51 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Apr 19 16:06:40 2019 +0200

Add XWordBasic.FileSaveAs() and implement

Factor out the setFilterPropsFromFormat() also used by
SwVbaDocument::SaveAs2000() to a header file of its own.

Change-Id: I4bc9e1e420719a115036beb7e82a4ac3feac05f0
Reviewed-on: https://gerrit.libreoffice.org/70980
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 40717488ce9f..5a381daf3867 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -18,6 +18,7 @@ interface XWordBasic
 
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
 void FileSave();
+void FileSaveAs( [in] any Name, [in] any Format, [in] any LockAnnot, [in] 
any Password, [in] any AddToMru, [in] any WritePassword, [in] any 
RecommendReadOnly, [in] any EmbedFonts, [in] any NativePictureFormat, [in] any 
FormsData, [in] any SaveAsAOCELetter );
 void FileClose( [in] any Save );
 void ToolsOptionsView( [in] any DraftFont, [in] any WrapToWindow, [in] any 
PicturePlaceHolders, [in] any FieldCodes, [in] any BookMarks, [in] any 
FieldShading, [in] any StatusBar, [in] any HScroll, [in] any VScroll, [in] any 
StyleAreaWidth, [in] any Tabs, [in] any Spaces, [in] any Paras, [in] any 
Hyphens, [in] any Hidden, [in] any ShowAll, [in] any Drawings, [in] any 
Anchors, [in] any TextBoundaries, [in] any VRuler, [in] any Highlight );
 any WindowName( [in] any Number );
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index f47f9affc00a..785c48a45057 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -19,9 +19,11 @@
 
 #include 
 #include 
+#include 
 
 #include "vbaapplication.hxx"
 #include "vbadocument.hxx"
+#include "vbafilterpropsfromformat.hxx"
 #include 
 #include 
 #include 
@@ -39,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "wordvbahelper.hxx"
@@ -46,6 +49,7 @@
 #include 
 #include 
 #include "vbalistgalleries.hxx"
+#include 
 
 using namespace ::ooo;
 using namespace ::ooo::vba;
@@ -78,6 +82,17 @@ public:
 
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
 virtual void SAL_CALL FileSave() override;
+virtual void SAL_CALL FileSaveAs( const css::uno::Any& Name,
+  const css::uno::Any& Format,
+  const css::uno::Any& LockAnnot,
+  const css::uno::Any& Password,
+  const css::uno::Any& AddToMru,
+  const css::uno::Any& WritePassword,
+  const css::uno::Any& RecommendReadOnly,
+  const css::uno::Any& EmbedFonts,
+  const css::uno::Any& NativePictureFormat,
+  const css::uno::Any& FormsData,
+  const css::uno::Any& SaveAsAOCELetter ) 
override;
 virtual void SAL_CALL FileClose( const css::uno::Any& Save ) override;
 virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont,
 const css::uno::Any& WrapToWindow,
@@ -551,6 +566,79 @@ SwWordBasic::FileSave()
 }
 
 void SAL_CALL
+SwWordBasic::FileSaveAs( const css::uno::Any& Name,
+ const css::uno::Any& Format,
+ const css::uno::Any& /*LockAnnot*/,
+ const css::uno::Any& /*Password*/,
+ const css::uno::Any& /*AddToMru*/,
+ const css::uno::Any& /*WritePassword*/,
+ const css::uno::Any& /*RecommendReadOnly*/,
+ const css::uno::Any& /*EmbedFonts*/,
+ const css::uno::Any& /*NativePictureFormat*/,
+ const css::uno::Any& /*FormsData*/,
+ const css::un

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-04-19 Thread Tor Lillqvist (via logerrit)
 oovbaapi/ooo/vba/word/XWordBasic.idl |   10 +-
 sw/source/ui/vba/vbaapplication.cxx  |   32 
 2 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit bb26b7577a30978ff207e7de88eb2c58549f9a60
Author: Tor Lillqvist 
AuthorDate: Tue Apr 2 08:46:07 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Fri Apr 19 14:31:55 2019 +0200

Change XWordBasic methods to return any

Possibly this is more in line with what callers expect.

Change-Id: Ie84b05a0bdb5ef1cb3e1f9fb7df6772831ff4980
Reviewed-on: https://gerrit.libreoffice.org/70975
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 908c963d6978..40717488ce9f 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -20,8 +20,8 @@ interface XWordBasic
 void FileSave();
 void FileClose( [in] any Save );
 void ToolsOptionsView( [in] any DraftFont, [in] any WrapToWindow, [in] any 
PicturePlaceHolders, [in] any FieldCodes, [in] any BookMarks, [in] any 
FieldShading, [in] any StatusBar, [in] any HScroll, [in] any VScroll, [in] any 
StyleAreaWidth, [in] any Tabs, [in] any Spaces, [in] any Paras, [in] any 
Hyphens, [in] any Hidden, [in] any ShowAll, [in] any Drawings, [in] any 
Anchors, [in] any TextBoundaries, [in] any VRuler, [in] any Highlight );
-string WindowName();
-boolean ExistingBookmark( [in] string Name );
+any WindowName( [in] any Number );
+any ExistingBookmark( [in] string Name );
 void MailMergeOpenDataSource( [in] string Name,
   [in] any Format,
   [in] any ConfirmConversions,
@@ -39,10 +39,10 @@ interface XWordBasic
   [in] any OpenExclusive,
   [in] any SubType );
 
-long AppMaximize( [in] any WindowName, [in] any State );
-long DocMaximize( [in] any State );
+any AppMaximize( [in] any WindowName, [in] any State );
+any DocMaximize( [in] any State );
 void AppShow( [in] any WindowName );
-long AppCount();
+any AppCount();
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 9dbe23c66289..f47f9affc00a 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -100,8 +100,8 @@ public:
 const css::uno::Any& 
TextBoundaries,
 const css::uno::Any& VRuler,
 const css::uno::Any& Highlight ) 
override;
-virtual OUString SAL_CALL WindowName() override;
-virtual sal_Bool SAL_CALL ExistingBookmark( const OUString& Name ) 
override;
+virtual css::uno::Any SAL_CALL WindowName( const css::uno::Any& Number ) 
override;
+virtual css::uno::Any SAL_CALL ExistingBookmark( const OUString& Name ) 
override;
 virtual void SAL_CALL MailMergeOpenDataSource(const OUString& Name, const 
css::uno::Any& Format,
   const css::uno::Any& 
ConfirmConversions, const css::uno::Any& ReadOnly,
   const css::uno::Any& 
LinkToSource, const css::uno::Any& AddToRecentFiles,
@@ -110,10 +110,10 @@ public:
   const css::uno::Any& 
WritePasswordTemplate, const css::uno::Any& Connection,
   const css::uno::Any& 
SQLStatement, const css::uno::Any& SQLStatement1,
   const css::uno::Any& 
OpenExclusive, const css::uno::Any& SubType) override;
-virtual sal_Int32 SAL_CALL AppMaximize( const css::uno::Any& WindowName, 
const css::uno::Any& State ) override;
-virtual sal_Int32 SAL_CALL DocMaximize( const css::uno::Any& State ) 
override;
+virtual css::uno::Any SAL_CALL AppMaximize( const css::uno::Any& 
WindowName, const css::uno::Any& State ) override;
+virtual css::uno::Any SAL_CALL DocMaximize( const css::uno::Any& State ) 
override;
 virtual void SAL_CALL AppShow(  const css::uno::Any& WindowName ) override;
-virtual sal_Int32 SAL_CALL AppCount() override;
+virtual css::uno::Any SAL_CALL AppCount() override;
 };
 
 SwVbaApplication::SwVbaApplication( uno::Reference& 
xContext ):
@@ -617,17 +617,17 @@ SwWordBasic::ToolsOptionsView( const css::uno::Any& 
DraftFont,
  << ")");
 }
 
-OUString SAL_CALL
-SwWordBasic::WindowName()
+css::uno::Any SAL_CALL
+SwWordBasic::WindowName( const css::uno::Any& /*Number*/ )
 {
-return mpApp->getActiveSwVbaWindow()->getCaption();
+return css::uno::makeAny( mpApp->getActiveSwVbaWindow()->getCaption() );
 }
 
-sal_Bool SAL_CALL
+css::uno::Any SAL_CALL
 SwWordBasic::ExistingBookmark( const OUString& Name )
 {
 uno::Reference< word::XBookmarks >

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-03-26 Thread Tor Lillqvist (via logerrit)
 oovbaapi/ooo/vba/word/XDocument.idl |3 
 sw/source/ui/vba/vbadocument.cxx|  113 
 sw/source/ui/vba/vbadocument.hxx|2 
 3 files changed, 118 insertions(+)

New commits:
commit 0f1458cff56e2be9614acc9357fd10099bb5e8ab
Author: Tor Lillqvist 
AuthorDate: Tue Mar 26 15:05:02 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Mar 26 15:55:04 2019 +0200

Add SaveAs2000() and SaveAs() to ooo.vba.word.XDocument and implement

Change-Id: If7e45e2f791a7806e6cf8e7fc9693e19e87d2dbb

diff --git a/oovbaapi/ooo/vba/word/XDocument.idl 
b/oovbaapi/ooo/vba/word/XDocument.idl
index 9259fc9fa4a9..888287b34e1b 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -61,6 +61,9 @@ interface XDocument
 void ClosePrintPreview();
 any Revisions( [in] any index );
 any Frames( [in] any index );
+void SaveAs2000( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter 
);
+void SaveAs( [in] any FileName, [in] any FileFormat, [in] any 
LockComments, [in] any Password, [in] any AddToRecentFiles, [in] any 
WritePassword, [in] any ReadOnlyRecommended, [in] any EmbedTrueTypeFonts, [in] 
any SaveNativePictureFormat, [in] any SaveFormsData, [in] any SaveAsAOCELetter, 
[in] any Encoding, [in] any InsertLineBreaks, [in] any AllowSubstitutions, [in] 
any LineEnding, [in] any AddBiDiMarks );
+
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 1b9f5169206d..8be412841206 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -28,15 +28,20 @@
 #include "vbabookmarks.hxx"
 #include "vbamailmerge.hxx"
 #include "vbavariables.hxx"
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -451,6 +456,114 @@ SwVbaDocument::Frames( const uno::Any& index )
 return uno::makeAny( xCol );
 }
 
+namespace {
+
+bool setFilterPropsFromFormat( sal_Int32 nFormat, uno::Sequence< 
beans::PropertyValue >& rProps )
+{
+bool bRes = false;
+for ( sal_Int32 index = 0; index < rProps.getLength(); ++index )
+{
+if ( rProps[ index ].Name == "FilterName" )
+{
+switch( nFormat )
+{
+case word::WdSaveFormat::wdFormatDocument:
+rProps[ index ].Value <<= OUString("MS Word 97");
+break;
+// Just save all the text formats as "Text"
+case word::WdSaveFormat::wdFormatDOSText:
+case word::WdSaveFormat::wdFormatDOSTextLineBreaks:
+case word::WdSaveFormat::wdFormatEncodedText:
+case word::WdSaveFormat::wdFormatText:
+case word::WdSaveFormat::wdFormatTextLineBreaks:
+rProps[ index ].Value <<= OUString("Text");
+break;
+case word::WdSaveFormat::wdFormatFilteredHTML:
+case word::WdSaveFormat::wdFormatHTML:
+rProps[ index ].Value <<= OUString("HTML");
+break;
+case word::WdSaveFormat::wdFormatRTF:
+rProps[ index ].Value <<= OUString("Rich Text Format");
+break;
+case word::WdSaveFormat::wdFormatTemplate:
+rProps[ index ].Value <<= OUString("MS Word 97 Vorlage");
+break;
+
+// Default to "MS Word 97"
+default:
+rProps[ index ].Value <<= OUString("MS Word 97");
+break;
+}
+bRes = true;
+break;
+}
+}
+return bRes;
+}
+
+}
+
+void SAL_CALL
+SwVbaDocument::SaveAs2000( const uno::Any& FileName, const uno::Any& 
FileFormat, const uno::Any& /*LockComments*/, const uno::Any& /*Password*/, 
const uno::Any& /*AddToRecentFiles*/, const uno::Any& /*WritePassword*/, const 
uno::Any& /*ReadOnlyRecommended*/, const uno::Any& /*EmbedTrueTypeFonts*/, 
const uno::Any& /*SaveNativePictureFormat*/, const uno::Any& /*SaveFormsData*/, 
const uno::Any& /*SaveAsAOCELetter*/ )
+{
+// Based on ScVbaWorkbook::SaveAs.
+OUString sFileName;
+FileName >>= sFileName;
+OUString sURL;
+osl::FileBase::getFileURLFromSystemPath( sFileName, sURL );
+
+// Detect if there is no path then we need to use the current folder.
+INetURLObject aURL( sURL );
+sURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
+if( sURL.isEmpty() )
+{
+// Need to add cur dir ( of this document ) or else the 'Work' dir
+sURL = getModel()->getURL();
+
+if ( sURL.isEmpty() )
+  

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-01-23 Thread Libreoffice Gerrit user
 oovbaapi/ooo/vba/word/XWordBasic.idl |1 +
 sw/source/ui/vba/vbaapplication.cxx  |   20 
 2 files changed, 21 insertions(+)

New commits:
commit 82ed9aa096aea95c2a9fe0ca9c1d27b70dcbc8fa
Author: Tor Lillqvist 
AuthorDate: Wed Jan 23 18:33:50 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Jan 24 00:33:14 2019 +0200

Add WordBasic.FileClose()

Change-Id: Ifc48e5fbcc212f0e80cf6877e2781910e38e5e54

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index d704b92b122c..5150a431401b 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -18,6 +18,7 @@ interface XWordBasic
 
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
 void FileSave();
+void FileClose( [in] any Save );
 void ToolsOptionsView( [in] any DraftFont, [in] any WrapToWindow, [in] any 
PicturePlaceHolders, [in] any FieldCodes, [in] any BookMarks, [in] any 
FieldShading, [in] any StatusBar, [in] any HScroll, [in] any VScroll, [in] any 
StyleAreaWidth, [in] any Tabs, [in] any Spaces, [in] any Paras, [in] any 
Hyphens, [in] any Hidden, [in] any ShowAll, [in] any Drawings, [in] any 
Anchors, [in] any TextBoundaries, [in] any VRuler, [in] any Highlight );
 string WindowName();
 boolean ExistingBookmark( [in] string Name );
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 6836f5ab7c5d..d9e33430c9d1 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -77,6 +77,7 @@ public:
 
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
 virtual void SAL_CALL FileSave() override;
+virtual void SAL_CALL FileClose( const css::uno::Any& Save ) override;
 virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont,
 const css::uno::Any& WrapToWindow,
 const css::uno::Any& 
PicturePlaceHolders,
@@ -539,6 +540,25 @@ SwWordBasic::FileSave()
 }
 
 void SAL_CALL
+SwWordBasic::FileClose( const css::uno::Any& Save )
+{
+uno::Reference< frame::XModel > xModel( mpApp->getCurrentDocument(), 
uno::UNO_SET_THROW );
+
+bool bSave = false;
+if (Save.hasValue() && (Save >>= bSave) && bSave)
+FileSave();
+
+// FIXME: Here I would much prefer to call VbaDocumentBase::Close() but 
not sure how to get at
+// the VbaDocumentBase of the current document. (Probably it is easy and I 
haven't looked hard
+// enough.)
+//
+// FIXME: Error handling. If there is no current document, return some 
kind of error? But for
+// now, just ignore errors. This code is written to work for a very 
specific customer use case
+// ayway, not for an arbitrary sequence of COM calls to the "VBA" API.
+dispatchRequests(xModel,".uno:CloseDoc");
+}
+
+void SAL_CALL
 SwWordBasic::ToolsOptionsView( const css::uno::Any& DraftFont,
const css::uno::Any& WrapToWindow,
const css::uno::Any& PicturePlaceHolders,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-01-22 Thread Libreoffice Gerrit user
 oovbaapi/ooo/vba/word/XWordBasic.idl |9 --
 sw/source/ui/vba/vbaapplication.cxx  |  106 +--
 2 files changed, 66 insertions(+), 49 deletions(-)

New commits:
commit 099ef7cfd7d9a482a7aa7a9307f55aa35ec2cbf5
Author: Tor Lillqvist 
AuthorDate: Tue Jan 22 13:59:18 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Jan 22 14:39:50 2019 +0200

Found documentation for WordBasic.ToolsOptionsView()

Change-Id: Ic049f78fddcaabafbe6be18b92a87b56352c1a4c

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 24f4853024c9..d704b92b122c 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -18,14 +18,7 @@ interface XWordBasic
 
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
 void FileSave();
-// There is no documentation for ToolsOptionsView, but all examples seem 
to pass it only named
-// parameters, so the order of parameters in the definition doesn't 
matter, I hope. Define some
-// (named) parameters found in sample code on the net. And ones found in 
customer code as
-// necessary later.
-//
-// If it turns out that ToolsOptionsView is actually called with both 
named and positional parameters in customer code
-// we might be in trouble.
-void ToolsOptionsView( [in] any FieldCodes, [in] any ShowAll, [in] any 
Whatever3, [in] any Whatever4, [in] any Whatever5, [in] any Whatever6, [in] any 
Whatever7, [in] any Whatever8, [in] any Whatever9, [in] any Whatever10, [in] 
any Whatever11, [in] any Whatever12, [in] any Whatever13, [in] any Whatever14, 
[in] any Whatever15, [in] any Whatever16, [in] any Whatever17, [in] any 
Whatever18, [in] any Whatever19, [in] any Whatever20 );
+void ToolsOptionsView( [in] any DraftFont, [in] any WrapToWindow, [in] any 
PicturePlaceHolders, [in] any FieldCodes, [in] any BookMarks, [in] any 
FieldShading, [in] any StatusBar, [in] any HScroll, [in] any VScroll, [in] any 
StyleAreaWidth, [in] any Tabs, [in] any Spaces, [in] any Paras, [in] any 
Hyphens, [in] any Hidden, [in] any ShowAll, [in] any Drawings, [in] any 
Anchors, [in] any TextBoundaries, [in] any VRuler, [in] any Highlight );
 string WindowName();
 boolean ExistingBookmark( [in] string Name );
 void MailMergeOpenDataSource( [in] string Name,
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index e335e167792b..16416204ca0f 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -77,26 +77,27 @@ public:
 
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
 virtual void SAL_CALL FileSave() override;
-virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& FieldCodes,
+virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& DraftFont,
+const css::uno::Any& WrapToWindow,
+const css::uno::Any& 
PicturePlaceHolders,
+const css::uno::Any& FieldCodes,
+const css::uno::Any& BookMarks,
+const css::uno::Any& FieldShading,
+const css::uno::Any& StatusBar,
+const css::uno::Any& HScroll,
+const css::uno::Any& VScroll,
+const css::uno::Any& 
StyleAreaWidth,
+const css::uno::Any& Tabs,
+const css::uno::Any& Spaces,
+const css::uno::Any& Paras,
+const css::uno::Any& Hyphens,
+const css::uno::Any& Hidden,
 const css::uno::Any& ShowAll,
-const css::uno::Any& Whatever3,
-const css::uno::Any& Whatever4,
-const css::uno::Any& Whatever5,
-const css::uno::Any& Whatever6,
-const css::uno::Any& Whatever7,
-const css::uno::Any& Whatever8,
-const css::uno::Any& Whatever9,
-  

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2019-01-21 Thread Libreoffice Gerrit user
 oovbaapi/ooo/vba/word/XWordBasic.idl |9 -
 sw/source/ui/vba/vbaapplication.cxx  |8 
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 775dd70bb9d50f0bbc8d9e5c6e09fd6e76b3aefe
Author: Tor Lillqvist 
AuthorDate: Mon Jan 21 18:08:12 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Mon Jan 21 18:09:50 2019 +0200

Add a couple of known parameters to WordBasic.ToolsOptionsView

Change-Id: Ifd472f4ca79ab97a1d6d5c5007537375121f6f58

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 320787361ca9..24f4853024c9 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -18,7 +18,14 @@ interface XWordBasic
 
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
 void FileSave();
-void ToolsOptionsView( [in] any Whatever1, [in] any Whatever2, [in] any 
Whatever3, [in] any Whatever4, [in] any Whatever5, [in] any Whatever6, [in] any 
Whatever7, [in] any Whatever8, [in] any Whatever9, [in] any Whatever10, [in] 
any Whatever11, [in] any Whatever12, [in] any Whatever13, [in] any Whatever14, 
[in] any Whatever15, [in] any Whatever16, [in] any Whatever17, [in] any 
Whatever18, [in] any Whatever19, [in] any Whatever20 );
+// There is no documentation for ToolsOptionsView, but all examples seem 
to pass it only named
+// parameters, so the order of parameters in the definition doesn't 
matter, I hope. Define some
+// (named) parameters found in sample code on the net. And ones found in 
customer code as
+// necessary later.
+//
+// If it turns out that ToolsOptionsView is actually called with both 
named and positional parameters in customer code
+// we might be in trouble.
+void ToolsOptionsView( [in] any FieldCodes, [in] any ShowAll, [in] any 
Whatever3, [in] any Whatever4, [in] any Whatever5, [in] any Whatever6, [in] any 
Whatever7, [in] any Whatever8, [in] any Whatever9, [in] any Whatever10, [in] 
any Whatever11, [in] any Whatever12, [in] any Whatever13, [in] any Whatever14, 
[in] any Whatever15, [in] any Whatever16, [in] any Whatever17, [in] any 
Whatever18, [in] any Whatever19, [in] any Whatever20 );
 string WindowName();
 boolean ExistingBookmark( [in] string Name );
 void MailMergeOpenDataSource( [in] string Name,
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 90196adf5008..e335e167792b 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -77,8 +77,8 @@ public:
 
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
 virtual void SAL_CALL FileSave() override;
-virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& Whatever1,
-const css::uno::Any& Whatever2,
+virtual void SAL_CALL ToolsOptionsView( const css::uno::Any& FieldCodes,
+const css::uno::Any& ShowAll,
 const css::uno::Any& Whatever3,
 const css::uno::Any& Whatever4,
 const css::uno::Any& Whatever5,
@@ -538,8 +538,8 @@ SwWordBasic::FileSave()
 }
 
 void SAL_CALL
-SwWordBasic::ToolsOptionsView( const css::uno::Any& /*Whatever1*/,
-   const css::uno::Any& /*Whatever2*/,
+SwWordBasic::ToolsOptionsView( const css::uno::Any& /*FieldCodes*/,
+   const css::uno::Any& /*ShowAll*/,
const css::uno::Any& /*Whatever3*/,
const css::uno::Any& /*Whatever4*/,
const css::uno::Any& /*Whatever5*/,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-06-12 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XWordBasic.idl |1 +
 sw/source/ui/vba/vbaapplication.cxx  |9 +
 2 files changed, 10 insertions(+)

New commits:
commit 1f6e884617ee20739216764144fe485ac7cfe6c6
Author: Tor Lillqvist 
Date:   Tue Jun 12 17:58:44 2018 +0300

Add ExistingBookmark() to WordBasic

Change-Id: I8f433b1ae5cc23aaa08935e87fca7674064ce881
Reviewed-on: https://gerrit.libreoffice.org/55706
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 94b810869061..31484c98d445 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -16,6 +16,7 @@ interface XWordBasic
 {
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
 string WindowName();
+boolean ExistingBookmark( [in] string Name );
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 5110118577ce..441f1b6841af 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "wordvbahelper.hxx"
@@ -71,6 +72,7 @@ public:
 // XWordBasic
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
 virtual OUString SAL_CALL WindowName() override;
+virtual sal_Bool SAL_CALL ExistingBookmark( const OUString& Name ) 
override;
 };
 
 SwVbaApplication::SwVbaApplication( uno::Reference& 
xContext ):
@@ -466,4 +468,11 @@ SwWordBasic::WindowName()
 return mpApp->getActiveSwVbaWindow()->getCaption();
 }
 
+sal_Bool SAL_CALL
+SwWordBasic::ExistingBookmark( const OUString& Name )
+{
+uno::Reference< word::XBookmarks > xBookmarks( 
mpApp->getActiveDocument()->Bookmarks( uno::Any() ), uno::UNO_QUERY );
+return xBookmarks.is() && xBookmarks->Exists( Name );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-06-12 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XWordBasic.idl |1 +
 sw/source/ui/vba/vbaapplication.cxx  |7 +++
 sw/source/ui/vba/vbaapplication.hxx  |3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 721c4fc126481f43be86442a73c1bfda8e06cdea
Author: Tor Lillqvist 
Date:   Tue Jun 12 16:20:57 2018 +0300

Add ooo.vba.word.XWordBasic.WindowName() method

Change-Id: I0ff24c3bc331d55212855d79060eaa6f8f3dc013
Reviewed-on: https://gerrit.libreoffice.org/55705
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XWordBasic.idl 
b/oovbaapi/ooo/vba/word/XWordBasic.idl
index 1920f20543a6..94b810869061 100644
--- a/oovbaapi/ooo/vba/word/XWordBasic.idl
+++ b/oovbaapi/ooo/vba/word/XWordBasic.idl
@@ -15,6 +15,7 @@ module ooo {  module vba {  module word {
 interface XWordBasic
 {
 void FileOpen( [in] string Name, [in] any ConfirmConversions, [in] any 
ReadOnly, [in] any AddToMru, [in] any PasswordDoc, [in] any PasswordDot, [in] 
any Revert, [in] any WritePasswordDoc, [in] any WritePasswordDot );
+string WindowName();
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index f3bdd9968667..5110118577ce 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -70,6 +70,7 @@ public:
 
 // XWordBasic
 virtual void SAL_CALL FileOpen( const OUString& Name, const uno::Any& 
ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToMru, const 
uno::Any& PasswordDoc, const uno::Any& PasswordDot, const uno::Any& Revert, 
const uno::Any& WritePasswordDoc, const uno::Any& WritePasswordDot ) override;
+virtual OUString SAL_CALL WindowName() override;
 };
 
 SwVbaApplication::SwVbaApplication( uno::Reference& 
xContext ):
@@ -459,4 +460,10 @@ SwWordBasic::FileOpen( const OUString& Name, const 
uno::Any& ConfirmConversions,
 rDocuments->Open( Name, ConfirmConversions, ReadOnly, AddToMru, 
PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, 
uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), 
uno::Any() );
 }
 
+OUString SAL_CALL
+SwWordBasic::WindowName()
+{
+return mpApp->getActiveSwVbaWindow()->getCaption();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/vba/vbaapplication.hxx 
b/sw/source/ui/vba/vbaapplication.hxx
index c7e73dd6da26..c032ea546dfe 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -49,7 +49,6 @@ typedef cppu::ImplInheritanceHelper< VbaApplicationBase, 
ooo::vba::word::XApplic
 class SwVbaApplication : public SwVbaApplication_BASE
 {
 std::vector> mvSinks;
-SwVbaWindow* getActiveSwVbaWindow();
 
 public:
 explicit SwVbaApplication( css::uno::Reference< 
css::uno::XComponentContext >& m_xContext );
@@ -58,6 +57,8 @@ public:
 sal_uInt32 AddSink( const css::uno::Reference< ooo::vba::XSink >& xSink );
 void RemoveSink( sal_uInt32 nNumber );
 
+SwVbaWindow* getActiveSwVbaWindow();
+
 // XApplication
 virtual OUString SAL_CALL getName() override;
 virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL 
getSystem() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-06-12 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XWindow.idl |1 +
 sw/source/ui/vba/vbawindow.cxx|   31 +++
 sw/source/ui/vba/vbawindow.hxx|2 ++
 3 files changed, 34 insertions(+)

New commits:
commit 524cfd3ea06070dd3219c20bcbfc6bf347f13926
Author: Tor Lillqvist 
Date:   Tue Jun 12 16:16:26 2018 +0300

Add ooo.vba.word.XWindow.Caption property

Change-Id: Ifa94b95d935975a87322afebfe604a4016f5a53f
Reviewed-on: https://gerrit.libreoffice.org/55692
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XWindow.idl 
b/oovbaapi/ooo/vba/word/XWindow.idl
index 9ad98654cfff..649cad3415f7 100644
--- a/oovbaapi/ooo/vba/word/XWindow.idl
+++ b/oovbaapi/ooo/vba/word/XWindow.idl
@@ -32,6 +32,7 @@ interface XWindow : com::sun::star::uno::XInterface
 {
 [attribute] any View;
 [attribute] any WindowState;
+[attribute] string Caption;
 void Activate();
 void Close([in] any SaveChanges, [in] any RouteDocument);
 any Panes( [in] any Index ); // this is a fake api for it seems not 
support in Write
diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx
index 458fb400d758..aba495a199b8 100644
--- a/sw/source/ui/vba/vbawindow.cxx
+++ b/sw/source/ui/vba/vbawindow.cxx
@@ -113,6 +113,37 @@ SwVbaWindow::setWindowState( const uno::Any& _windowstate )
 }
 }
 
+OUString SAL_CALL
+SwVbaWindow::getCaption()
+{
+SwView* pView = word::getView( m_xModel );
+if( !pView )
+return OUString("");
+
+uno::Reference< css::beans::XPropertySet > xFrameProps( 
pView->GetViewFrame()->GetFrame().GetFrameInterface()->getController()->getFrame(),
 uno::UNO_QUERY );
+if( !xFrameProps.is() )
+return OUString("");
+
+OUString sTitle;
+xFrameProps->getPropertyValue( "Title" ) >>= sTitle;
+
+return sTitle;
+}
+
+void SAL_CALL
+SwVbaWindow::setCaption( const OUString& _caption )
+{
+SwView* pView = word::getView( m_xModel );
+if( !pView )
+return;
+
+uno::Reference< css::beans::XPropertySet > xFrameProps( 
pView->GetViewFrame()->GetFrame().GetFrameInterface()->getController()->getFrame(),
 uno::UNO_QUERY );
+if( !xFrameProps.is() )
+return;
+
+xFrameProps->setPropertyValue( "Title", uno::makeAny( _caption ) );
+}
+
 uno::Any SAL_CALL
 SwVbaWindow::Panes( const uno::Any& aIndex )
 {
diff --git a/sw/source/ui/vba/vbawindow.hxx b/sw/source/ui/vba/vbawindow.hxx
index e5f7296a8ba5..ee435b1505ac 100644
--- a/sw/source/ui/vba/vbawindow.hxx
+++ b/sw/source/ui/vba/vbawindow.hxx
@@ -42,6 +42,8 @@ public:
 virtual void SAL_CALL setView( const css::uno::Any& _view ) override;
 virtual css::uno::Any SAL_CALL getWindowState() override;
 virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) 
override;
+virtual OUString SAL_CALL getCaption() override;
+virtual void SAL_CALL setCaption( const OUString& _caption ) override;
 // Methods
 virtual void SAL_CALL Activate(  ) override;
 virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const 
css::uno::Any& RouteDocument ) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-06-07 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XApplication.idl |   10 ++
 sw/source/ui/vba/vbaapplication.cxx|   17 +
 sw/source/ui/vba/vbaapplication.hxx|2 ++
 3 files changed, 29 insertions(+)

New commits:
commit d9fc8b494be53bacffe45564e98da61ae5b28bd3
Author: Tor Lillqvist 
Date:   Thu Jun 7 12:02:23 2018 +0300

Add ooo.vba.word.Application.StatusBar property for debug output from client

In many cases you don't want to use a bunch of MessageBox() calls in a
VB6 client you are developing against LibreOffice, as that disrupts
the working of the client. The developer might not mind, but other
people trying it will be bothered by having to click through a stream
of message boxes. Also, it is hard to correctly interpret the
chronological sequence of LibreOffice's own debug output lines and
such MessageBox() windows.

WScript.Echo calls from a VBScript client are a bit better as they
don't require any click-through, but still there is the problem of
correlating with LibreOffice's own debug output.

Setting this StatusBar property causes LibreOffice to output a
SAL_INFO line with the tag "extensions.olebridge". Thus they are
automatically merged with LibreOffice's own output and displayed in
correct order.

Sure, the intent of some existing 3rd-party client that sets this
property would be to actually display a message in the status bar
(whatever that corresponds to in LibreOffice), but until some such
need is actually encountered, it's enough to just use it for this
debug output functionality. After all, this property was not
implemented at all earlier, so adding it now with somewhat special
semantics is not a regression.

(Note that on the Calc side, ooo.vba.excel.XApplication did have a
StatusBar property already, and setting that does seem to attempt to
display the text in some way. Possibly it should be enhanced to also
do the SAL_INFO thing, for consistency? And possibly we should also
have the message being displayed in the same fashion on the Writer
side?)

Change-Id: I5bf1e776d6401adfc43a558a2d919bd675298e1a
Reviewed-on: https://gerrit.libreoffice.org/55413
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XApplication.idl 
b/oovbaapi/ooo/vba/word/XApplication.idl
index 62319f63a932..d061586b8de1 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -40,6 +40,16 @@ interface XApplication : XConnectable
 [attribute] long Height;
 [attribute] long Left;
 [attribute] long Top;
+// Setting this displays the string in a SAL_INFO message with tag
+// extensions.olebridge. Provides a way to get a message from an
+// Automation client into LibreOffice's debug output. Less
+// disruptive than a MessageBox() in a VB6 client, for instance.
+// And makes it possible to get merged debug output from both the client
+// and LibreOffice in proper synchronized order.
+//
+// Actually write-only but there is no way to say that in UNO IDL.
+// The getter just returns an empty string.
+[attribute] string StatusBar;
 
 any CommandBars( [in] any Index );
 any Documents( [in] any Index );
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 37358d2cc51d..3fcfc12f3a1e 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -288,6 +288,23 @@ void SAL_CALL SwVbaApplication::setTop( sal_Int32 _top )
 pWindow->setTop( _top );
 }
 
+OUString SAL_CALL SwVbaApplication::getStatusBar()
+{
+return OUString("");
+}
+
+void SAL_CALL SwVbaApplication::setStatusBar( const OUString& _statusbar )
+{
+// Yes, we intentionally use the "extensions.olebridge" tag here even if 
this is sw. We
+// interpret setting the StatusBar property as a request from an 
Automation client to display
+// the string in LibreOffice's debug output, and all other generic 
Automation support debug
+// output (in extensions/source/ole) uses that tag. If the check for 
"cross-module" or mixed log
+// areas in compilerplugins/clang/sallogareas.cxx is re-activated, this 
will have to be added as
+// a special case.
+
+SAL_INFO("extensions.olebridge", "Client debug output: " << _statusbar);
+}
+
 float SAL_CALL SwVbaApplication::CentimetersToPoints( float Centimeters )
 {
 return VbaApplicationBase::CentimetersToPoints( Centimeters );
diff --git a/sw/source/ui/vba/vbaapplication.hxx 
b/sw/source/ui/vba/vbaapplication.hxx
index 9cf2da2a5dd8..c7e73dd6da26 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -85,6 +85,8 @@ public:
 virtual void SAL_CALL setLeft( sal_Int32 _left ) override;
 virtual sal_Int32 SAL_CALL getTop() override;
 virtual void SAL_CALL setTop( sal_Int32 _top ) override;
+vi

[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-05-31 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XApplication.idl |1 +
 sw/source/ui/vba/vbaapplication.cxx|   17 +++--
 sw/source/ui/vba/vbaapplication.hxx|4 
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 5abf9d268d51afeaea2ed6f2a81a92ad46dea1cd
Author: Tor Lillqvist 
Date:   Mon Apr 16 21:50:55 2018 +0300

Add Resize() method to ooo.vba.word.XApplication

Seems to be commonly called by 3rd-party Automation (and VB6) client
code.

Change-Id: I29ee5e7d95f3da2ffae0fac44151148be6e272ee

diff --git a/oovbaapi/ooo/vba/word/XApplication.idl 
b/oovbaapi/ooo/vba/word/XApplication.idl
index ea709e7ec2b2..ce047e0d08ac 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -43,6 +43,7 @@ interface XApplication : XConnectable
 any ListGalleries( [in] any aIndex );
 float CentimetersToPoints([in] float Centimeters );
 void ShowMe();
+void Resize( [in] long Width, [in] long Height );
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index d9d245a12d49..ee743252c698 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -99,8 +99,8 @@ SwVbaApplication::getActiveDocument()
 return new SwVbaDocument( this, mxContext, getCurrentDocument() );
 }
 
-uno::Reference< word::XWindow > SAL_CALL
-SwVbaApplication::getActiveWindow()
+SwVbaWindow *
+SwVbaApplication::getActiveSwVbaWindow()
 {
 // #FIXME so far can't determine Parent
 uno::Reference< frame::XModel > xModel( getCurrentDocument(), 
uno::UNO_SET_THROW );
@@ -108,6 +108,12 @@ SwVbaApplication::getActiveWindow()
 return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, 
xModel, xController );
 }
 
+uno::Reference< word::XWindow > SAL_CALL
+SwVbaApplication::getActiveWindow()
+{
+return getActiveSwVbaWindow();
+}
+
 uno::Reference SAL_CALL
 SwVbaApplication::getSystem()
 {
@@ -225,6 +231,13 @@ void SAL_CALL SwVbaApplication::ShowMe()
 // No idea what we should or could do
 }
 
+void SAL_CALL SwVbaApplication::Resize( sal_Int32 Width, sal_Int32 Height )
+{
+auto pWindow = getActiveSwVbaWindow();
+pWindow->setWidth( Width );
+pWindow->setHeight( Height );
+}
+
 // XInterfaceWithIID
 
 OUString SAL_CALL
diff --git a/sw/source/ui/vba/vbaapplication.hxx 
b/sw/source/ui/vba/vbaapplication.hxx
index 808f7c1c10b8..137db4d95591 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+#include "vbawindow.hxx"
+
 typedef cppu::ImplInheritanceHelper< VbaApplicationBase, 
ooo::vba::word::XApplication, ooo::vba::XSinkCaller > SwVbaApplication_BASE;
 
 // This class is currently not a singleton. One instance is created per 
document with (potential?)
@@ -47,6 +49,7 @@ typedef cppu::ImplInheritanceHelper< VbaApplicationBase, 
ooo::vba::word::XApplic
 class SwVbaApplication : public SwVbaApplication_BASE
 {
 std::vector> mvSinks;
+SwVbaWindow* getActiveSwVbaWindow();
 
 public:
 explicit SwVbaApplication( css::uno::Reference< 
css::uno::XComponentContext >& m_xContext );
@@ -75,6 +78,7 @@ public:
 virtual void SAL_CALL setWindowState( sal_Int32 _windowstate ) override;
 virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
 virtual void SAL_CALL ShowMe() override;
+virtual void SAL_CALL Resize( sal_Int32 Width, sal_Int32 Height ) override;
 
 // XInterfaceWithIID
 virtual OUString SAL_CALL getIID() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oovbaapi/ooo sw/source

2018-05-30 Thread Tor Lillqvist
 oovbaapi/ooo/vba/word/XApplication.idl |1 +
 sw/source/ui/vba/vbaapplication.cxx|5 +
 sw/source/ui/vba/vbaapplication.hxx|1 +
 3 files changed, 7 insertions(+)

New commits:
commit 4eb739592d0de1cb02a2604c45b60e9453b532b7
Author: Tor Lillqvist 
Date:   Wed Mar 7 14:34:54 2018 +0200

Add a (dummy) ooo::vba::word::XApplication::ShowMe() implementation

Some customer VB6 code calls it. It doesn't seem to do anything
interesting in Word either, so I don't feel that bad for it not doing
anything in Writer.

Change-Id: I81162fcdd0caa22b19760f8cb40266f7f571d8ce
Reviewed-on: https://gerrit.libreoffice.org/55069
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/oovbaapi/ooo/vba/word/XApplication.idl 
b/oovbaapi/ooo/vba/word/XApplication.idl
index 9de2a98d3483..0d667551e4a3 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -46,6 +46,7 @@ interface XApplication : com::sun::star::uno::XInterface
 any Dialogs( [in] any Index );
 any ListGalleries( [in] any aIndex );
 float CentimetersToPoints([in] float Centimeters );
+void ShowMe();
 };
 
 }; }; };
diff --git a/sw/source/ui/vba/vbaapplication.cxx 
b/sw/source/ui/vba/vbaapplication.cxx
index 282ca8979bfd..4ffd6766d7af 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -154,6 +154,11 @@ float SAL_CALL SwVbaApplication::CentimetersToPoints( 
float Centimeters )
 return VbaApplicationBase::CentimetersToPoints( Centimeters );
 }
 
+void SAL_CALL SwVbaApplication::ShowMe()
+{
+// No idea what we should or could do
+}
+
 uno::Reference< frame::XModel >
 SwVbaApplication::getCurrentDocument()
 {
diff --git a/sw/source/ui/vba/vbaapplication.hxx 
b/sw/source/ui/vba/vbaapplication.hxx
index eb9380703316..161a5284d86b 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -55,6 +55,7 @@ public:
 virtual sal_Int32 SAL_CALL getEnableCancelKey() override;
 virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) 
override;
 virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
+virtual void SAL_CALL ShowMe() override;
 // XHelperInterface
 virtual OUString getServiceImplName() override;
 virtual css::uno::Sequence getServiceNames() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits