1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include <swtypes.hxx>
21 #include <dbtablepreviewdialog.hxx>
22 #include <comphelper/processfactory.hxx>
23 #include <com/sun/star/frame/Frame.hpp>
24 #include <toolkit/unohlp.hxx>
27 #include <dbtablepreviewdialog.hrc>
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::frame
;
33 using namespace ::com::sun::star::beans
;
34 using namespace ::com::sun::star::lang
;
35 using namespace ::com::sun::star::util
;
36 using namespace ::rtl
;
38 SwDBTablePreviewDialog::SwDBTablePreviewDialog(Window
* pParent
, uno::Sequence
< beans::PropertyValue
>& rValues
) :
39 SfxModalDialog(pParent
, SW_RES(DLG_MM_DBTABLEPREVIEWDIALOG
)),
41 #pragma warning (disable : 4355)
43 m_aDescriptionFI( this, SW_RES( FI_DESCRIPTION
)),
44 m_pBeamerWIN( new Window(this, SW_RES( WIN_BEAMER
))),
45 m_aOK( this, SW_RES( PB_OK
))
47 #pragma warning (default : 4355)
51 const beans::PropertyValue
* pValues
= rValues
.getConstArray();
52 for(sal_Int32 nValue
= 0; nValue
< rValues
.getLength(); ++nValue
)
54 if ( pValues
[nValue
].Name
== "Command" )
56 String sDescription
= m_aDescriptionFI
.GetText();
58 pValues
[nValue
].Value
>>= sTemp
;
59 sDescription
.SearchAndReplaceAscii("%1", sTemp
);
60 m_aDescriptionFI
.SetText(sDescription
);
67 // create a frame wrapper for myself
68 m_xFrame
= frame::Frame::create( comphelper::getProcessComponentContext() );
69 m_xFrame
->initialize( VCLUnoHelper::GetInterface( m_pBeamerWIN
) );
71 catch (uno::Exception
const &)
78 aURL
.Complete
= ".component:DB/DataSourceBrowser";
79 uno::Reference
<frame::XDispatch
> xD
= m_xFrame
->queryDispatch(aURL
, "", 0x0C);
82 xD
->dispatch(aURL
, rValues
);
88 SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
92 m_xFrame
->setComponent(NULL
, NULL
);
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */