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