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

Tor Lillqvist tml at collabora.com
Tue Jun 12 15:14:30 UTC 2018


 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 <tml at collabora.com>
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 <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

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;


More information about the Libreoffice-commits mailing list