1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vbawindow.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include <vbahelper/helperdecl.hxx>
31 #include "vbawindow.hxx"
32 #include "vbaglobals.hxx"
33 #include "vbadocument.hxx"
34 #include "vbaview.hxx"
35 #include "vbapanes.hxx"
36 #include "vbapane.hxx"
38 using namespace ::com::sun::star
;
39 using namespace ::ooo::vba
;
41 SwVbaWindow::SwVbaWindow( const uno::Reference
< XHelperInterface
>& xParent
, const uno::Reference
< uno::XComponentContext
>& xContext
, const uno::Reference
< frame::XModel
>& xModel
) : WindowImpl_BASE( xParent
, xContext
, xModel
)
45 SwVbaWindow::SwVbaWindow( uno::Sequence
< uno::Any
> const & args
, uno::Reference
< uno::XComponentContext
> const & xContext
)
46 : WindowImpl_BASE( args
, xContext
)
51 SwVbaWindow::Activate() throw (css::uno::RuntimeException
)
53 SwVbaDocument
document( uno::Reference
< XHelperInterface
>( Application(), uno::UNO_QUERY_THROW
), mxContext
, m_xModel
);
59 SwVbaWindow::Close( const uno::Any
& SaveChanges
, const uno::Any
& RouteDocument
) throw (uno::RuntimeException
)
61 // FIXME: it is incorrect when there are more than 1 windows
62 SwVbaDocument
document( uno::Reference
< XHelperInterface
>( Application(), uno::UNO_QUERY_THROW
), mxContext
, m_xModel
);
64 document
.Close(SaveChanges
, FileName
, RouteDocument
);
68 SwVbaWindow::getView() throw (uno::RuntimeException
)
70 return uno::makeAny( uno::Reference
< word::XView
>( new SwVbaView( this, mxContext
, m_xModel
) ) );
73 void SAL_CALL
SwVbaWindow::setView( const uno::Any
& _view
) throw (uno::RuntimeException
)
78 SwVbaView
view( this, mxContext
, m_xModel
);
79 view
.setType( nType
);
84 SwVbaWindow::Panes( const uno::Any
& aIndex
) throw (uno::RuntimeException
)
86 uno::Reference
< XCollection
> xPanes( new SwVbaPanes( this, mxContext
, m_xModel
) );
87 if( aIndex
.getValueTypeClass() == uno::TypeClass_VOID
)
88 return uno::makeAny( xPanes
);
90 return uno::Any( xPanes
->Item( aIndex
, uno::Any() ) );
94 SwVbaWindow::ActivePane() throw (uno::RuntimeException
)
96 return uno::makeAny( uno::Reference
< word::XPane
>( new SwVbaPane( this, mxContext
, m_xModel
) ) );
100 SwVbaWindow::getServiceImplName()
102 static rtl::OUString
sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWindow") );
106 uno::Sequence
< rtl::OUString
>
107 SwVbaWindow::getServiceNames()
109 static uno::Sequence
< rtl::OUString
> aServiceNames
;
110 if ( aServiceNames
.getLength() == 0 )
112 aServiceNames
.realloc( 1 );
113 aServiceNames
[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Window" ) );
115 return aServiceNames
;