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 ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFDialog" ) );
47 : }
48 :
49 : // -----------------------------------------------------------------------------
50 :
51 0 : Sequence< sal_Int8 > SAL_CALL PDFDialog_getImplementationId()
52 : throw(RuntimeException)
53 : {
54 0 : static ::cppu::OImplementationId aId;
55 0 : return aId.getImplementationId();
56 : }
57 :
58 : // -----------------------------------------------------------------------------
59 :
60 0 : Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames()
61 : throw (RuntimeException)
62 : {
63 0 : Sequence < OUString > aRet(1);
64 0 : OUString* pArray = aRet.getArray();
65 0 : pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
66 0 : return aRet;
67 : }
68 :
69 : // -----------------------------------------------------------------------------
70 :
71 0 : Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
72 : throw( Exception )
73 : {
74 0 : return (cppu::OWeakObject*) new PDFDialog( rSMgr );
75 : }
76 :
77 : // -----------------------------------------------------------------------------
78 :
79 : #undef SERVICE_NAME
80 :
81 : // -------------
82 : // - PDFDialog -
83 : // -------------
84 :
85 0 : PDFDialog::PDFDialog( const Reference< XMultiServiceFactory > &rxMSF )
86 0 : : PDFDialog_Base( rxMSF )
87 : {
88 0 : }
89 :
90 : // -----------------------------------------------------------------------------
91 :
92 0 : PDFDialog::~PDFDialog()
93 : {
94 0 : }
95 :
96 : // -----------------------------------------------------------------------------
97 :
98 0 : Sequence< sal_Int8 > SAL_CALL PDFDialog::getImplementationId()
99 : throw(RuntimeException)
100 : {
101 0 : return PDFDialog_getImplementationId();
102 : }
103 :
104 : // -----------------------------------------------------------------------------
105 :
106 0 : OUString SAL_CALL PDFDialog::getImplementationName()
107 : throw (RuntimeException)
108 : {
109 0 : return PDFDialog_getImplementationName();
110 : }
111 :
112 : // -----------------------------------------------------------------------------
113 :
114 0 : Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
115 : throw (RuntimeException)
116 : {
117 0 : return PDFDialog_getSupportedServiceNames();
118 : }
119 :
120 : // -----------------------------------------------------------------------------
121 :
122 0 : Dialog* PDFDialog::createDialog( Window* pParent )
123 : {
124 0 : Dialog* pRet = NULL;
125 :
126 0 : if( mxSrcDoc.is() )
127 : {
128 0 : ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc, m_aContext.getLegacyServiceFactory() );
129 0 : pRet = pDlg;
130 : }
131 :
132 0 : return pRet;
133 : }
134 :
135 : // -----------------------------------------------------------------------------
136 :
137 0 : void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
138 : {
139 0 : if( nExecutionResult && m_pDialog )
140 0 : maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData();
141 0 : destroyDialog();
142 0 : }
143 :
144 : // -----------------------------------------------------------------------------
145 :
146 0 : Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo()
147 : throw(RuntimeException)
148 : {
149 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
150 0 : return xInfo;
151 : }
152 :
153 : //-------------------------------------------------------------------------
154 0 : ::cppu::IPropertyArrayHelper& PDFDialog::getInfoHelper()
155 : {
156 0 : return *const_cast<PDFDialog*>(this)->getArrayHelper();
157 : }
158 :
159 : //------------------------------------------------------------------------------
160 0 : ::cppu::IPropertyArrayHelper* PDFDialog::createArrayHelper() const
161 : {
162 0 : Sequence< Property > aProps;
163 0 : describeProperties(aProps);
164 0 : return new ::cppu::OPropertyArrayHelper( aProps );
165 : }
166 :
167 : // -----------------------------------------------------------------------------
168 :
169 0 : Sequence< PropertyValue > SAL_CALL PDFDialog::getPropertyValues()
170 : throw ( RuntimeException )
171 : {
172 : sal_Int32 i, nCount;
173 :
174 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
175 : {
176 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
177 0 : break;
178 : }
179 :
180 0 : if( i == nCount )
181 0 : maMediaDescriptor.realloc( ++nCount );
182 :
183 0 : maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
184 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
185 :
186 0 : return maMediaDescriptor;
187 : }
188 :
189 : // -----------------------------------------------------------------------------
190 :
191 0 : void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
192 : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
193 : {
194 0 : maMediaDescriptor = rProps;
195 :
196 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
197 : {
198 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
199 : {
200 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
201 0 : break;
202 : }
203 : }
204 0 : }
205 :
206 : // -----------------------------------------------------------------------------
207 :
208 0 : void SAL_CALL PDFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
209 : throw(IllegalArgumentException, RuntimeException)
210 : {
211 0 : mxSrcDoc = xDoc;
212 0 : }
213 :
214 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|