sc: factor out some more code
[LibreOffice.git] / sw / source / ui / vba / vbadialog.cxx
blobd4c224dfecde9b6e290e2628da686fd6dfb13c24
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include "vbadialog.hxx"
20 #include <ooo/vba/word/WdWordDialog.hpp>
21 #include <unotxdoc.hxx>
23 using namespace ::ooo::vba;
24 using namespace ::com::sun::star;
26 namespace {
28 struct WordDialogTable
30 sal_Int32 wdDialog;
31 const char* ooDialog;
36 const WordDialogTable aWordDialogTable[] =
38 { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" },
39 { word::WdWordDialog::wdDialogFileOpen, ".uno:Open" },
40 { word::WdWordDialog::wdDialogFilePrint, ".uno:Print" },
41 { word::WdWordDialog::wdDialogFileSaveAs, ".uno:SaveAs" },
42 { 0, nullptr }
45 SwVbaDialog::SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent,
46 const css::uno::Reference< css::uno::XComponentContext > & xContext,
47 const rtl::Reference< SwXTextDocument >& xModel,
48 sal_Int32 nIndex )
49 : SwVbaDialog_BASE( xParent, xContext, nIndex ), m_xModel(xModel) {}
51 css::uno::Reference< css::frame::XModel > SwVbaDialog::getModel() const
53 return static_cast<SfxBaseModel*>(m_xModel.get());
56 OUString
57 SwVbaDialog::mapIndexToName( sal_Int32 nIndex )
59 for (const WordDialogTable & rTable : aWordDialogTable)
61 if( nIndex == rTable.wdDialog )
63 return OUString::createFromAscii( rTable.ooDialog );
66 return OUString();
69 OUString
70 SwVbaDialog::getServiceImplName()
72 return u"SwVbaDialog"_ustr;
75 uno::Sequence< OUString >
76 SwVbaDialog::getServiceNames()
78 static uno::Sequence< OUString > const aServiceNames
80 u"ooo.vba.word.Dialog"_ustr
82 return aServiceNames;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */