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