Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "pdfdialog.hxx"
22 : #include "impdialog.hxx"
23 : #include <vcl/svapp.hxx>
24 : #include <vcl/dialog.hxx>
25 : #include <svl/solar.hrc>
26 : #include <com/sun/star/view/XRenderable.hpp>
27 :
28 : using namespace ::rtl;
29 : using namespace ::vcl;
30 : using namespace ::com::sun::star;
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::lang;
33 : using namespace ::com::sun::star::beans;
34 :
35 :
36 : // - PDFDialog functions -
37 :
38 :
39 : #define SERVICE_NAME "com.sun.star.document.PDFDialog"
40 :
41 :
42 :
43 0 : OUString PDFDialog_getImplementationName ()
44 : throw (RuntimeException)
45 : {
46 0 : return OUString ( "com.sun.star.comp.PDF.PDFDialog" );
47 : }
48 :
49 0 : Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames()
50 : throw (RuntimeException)
51 : {
52 0 : Sequence < OUString > aRet(1);
53 0 : OUString* pArray = aRet.getArray();
54 0 : pArray[0] = SERVICE_NAME;
55 0 : return aRet;
56 : }
57 :
58 :
59 :
60 0 : Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
61 : throw( Exception )
62 : {
63 0 : return (cppu::OWeakObject*) new PDFDialog( comphelper::getComponentContext(rSMgr) );
64 : }
65 :
66 :
67 :
68 : #undef SERVICE_NAME
69 :
70 :
71 : // - PDFDialog -
72 :
73 :
74 0 : PDFDialog::PDFDialog( const Reference< XComponentContext > &rxContext )
75 0 : : PDFDialog_Base( rxContext )
76 : {
77 0 : }
78 :
79 :
80 :
81 0 : PDFDialog::~PDFDialog()
82 : {
83 0 : }
84 :
85 :
86 :
87 0 : Sequence< sal_Int8 > SAL_CALL PDFDialog::getImplementationId()
88 : throw(RuntimeException, std::exception)
89 : {
90 0 : return css::uno::Sequence<sal_Int8>();
91 : }
92 :
93 :
94 :
95 0 : OUString SAL_CALL PDFDialog::getImplementationName()
96 : throw (RuntimeException, std::exception)
97 : {
98 0 : return PDFDialog_getImplementationName();
99 : }
100 :
101 :
102 :
103 0 : Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
104 : throw (RuntimeException, std::exception)
105 : {
106 0 : return PDFDialog_getSupportedServiceNames();
107 : }
108 :
109 :
110 :
111 0 : Dialog* PDFDialog::createDialog( Window* pParent )
112 : {
113 0 : Dialog* pRet = NULL;
114 :
115 0 : if( mxSrcDoc.is() )
116 : {
117 0 : ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc );
118 0 : pRet = pDlg;
119 : }
120 :
121 0 : return pRet;
122 : }
123 :
124 :
125 :
126 0 : void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
127 : {
128 0 : if( nExecutionResult && m_pDialog )
129 0 : maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData();
130 0 : destroyDialog();
131 0 : }
132 :
133 :
134 :
135 0 : Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo()
136 : throw(RuntimeException, std::exception)
137 : {
138 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
139 0 : return xInfo;
140 : }
141 :
142 :
143 0 : ::cppu::IPropertyArrayHelper& PDFDialog::getInfoHelper()
144 : {
145 0 : return *const_cast<PDFDialog*>(this)->getArrayHelper();
146 : }
147 :
148 :
149 0 : ::cppu::IPropertyArrayHelper* PDFDialog::createArrayHelper() const
150 : {
151 0 : Sequence< Property > aProps;
152 0 : describeProperties(aProps);
153 0 : return new ::cppu::OPropertyArrayHelper( aProps );
154 : }
155 :
156 :
157 :
158 0 : Sequence< PropertyValue > SAL_CALL PDFDialog::getPropertyValues()
159 : throw ( RuntimeException, std::exception )
160 : {
161 : sal_Int32 i, nCount;
162 :
163 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
164 : {
165 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
166 0 : break;
167 : }
168 :
169 0 : if( i == nCount )
170 0 : maMediaDescriptor.realloc( ++nCount );
171 :
172 0 : maMediaDescriptor[ i ].Name = "FilterData";
173 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
174 :
175 0 : return maMediaDescriptor;
176 : }
177 :
178 :
179 :
180 0 : void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
181 : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
182 : {
183 0 : maMediaDescriptor = rProps;
184 :
185 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
186 : {
187 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
188 : {
189 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
190 0 : break;
191 : }
192 : }
193 0 : }
194 :
195 :
196 :
197 0 : void SAL_CALL PDFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
198 : throw(IllegalArgumentException, RuntimeException, std::exception)
199 : {
200 0 : mxSrcDoc = xDoc;
201 0 : }
202 :
203 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|