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 <comphelper/serviceinfohelper.hxx>
22 :
23 : #include "SdUnoOutlineView.hxx"
24 :
25 : #include "DrawController.hxx"
26 : #include "OutlineViewShell.hxx"
27 : #include "sdpage.hxx"
28 : #include "unopage.hxx"
29 :
30 : #include <cppuhelper/proptypehlp.hxx>
31 : #include <svx/unopage.hxx>
32 : #include <osl/mutex.hxx>
33 : #include <vcl/svapp.hxx>
34 :
35 : using namespace ::cppu;
36 : using namespace ::com::sun::star;
37 : using namespace ::com::sun::star::uno;
38 :
39 :
40 :
41 : namespace sd {
42 :
43 0 : SdUnoOutlineView::SdUnoOutlineView(
44 : OutlineViewShell& rViewShell) throw()
45 : : DrawSubControllerInterfaceBase(m_aMutex),
46 0 : mrOutlineViewShell(rViewShell)
47 : {
48 0 : }
49 :
50 :
51 :
52 :
53 0 : SdUnoOutlineView::~SdUnoOutlineView (void) throw()
54 : {
55 0 : }
56 :
57 :
58 :
59 :
60 0 : void SAL_CALL SdUnoOutlineView::disposing (void)
61 : {
62 0 : }
63 :
64 :
65 :
66 :
67 : //----- XSelectionSupplier ----------------------------------------------------
68 :
69 0 : sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& )
70 : throw(lang::IllegalArgumentException, RuntimeException)
71 : {
72 : // todo: add selections for text ranges
73 0 : return sal_False;
74 : }
75 :
76 :
77 :
78 0 : Any SAL_CALL SdUnoOutlineView::getSelection()
79 : throw(RuntimeException)
80 : {
81 0 : Any aAny;
82 0 : return aAny;
83 : }
84 :
85 :
86 :
87 0 : void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
88 : const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
89 : throw(css::uno::RuntimeException)
90 : {
91 : (void)rxListener;
92 0 : }
93 :
94 :
95 :
96 :
97 0 : void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
98 : const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
99 : throw(css::uno::RuntimeException)
100 : {
101 : (void)rxListener;
102 0 : }
103 :
104 :
105 :
106 :
107 : //----- XDrawView -------------------------------------------------------------
108 :
109 :
110 0 : void SAL_CALL SdUnoOutlineView::setCurrentPage (
111 : const Reference< drawing::XDrawPage >& xPage)
112 : throw(RuntimeException)
113 : {
114 0 : SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
115 0 : SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
116 :
117 0 : if (pSdrPage != NULL)
118 0 : mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage));
119 0 : }
120 :
121 :
122 :
123 :
124 0 : Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void)
125 : throw(RuntimeException)
126 : {
127 0 : Reference<drawing::XDrawPage> xPage;
128 :
129 0 : SdPage* pPage = mrOutlineViewShell.getCurrentPage();
130 0 : if (pPage != NULL)
131 0 : xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage());
132 :
133 0 : return xPage;
134 : }
135 :
136 0 : void SdUnoOutlineView::setFastPropertyValue (
137 : sal_Int32 nHandle,
138 : const Any& rValue)
139 : throw(css::beans::UnknownPropertyException,
140 : css::beans::PropertyVetoException,
141 : css::lang::IllegalArgumentException,
142 : css::lang::WrappedTargetException,
143 : css::uno::RuntimeException)
144 : {
145 0 : switch( nHandle )
146 : {
147 : case DrawController::PROPERTY_CURRENTPAGE:
148 : {
149 0 : Reference< drawing::XDrawPage > xPage;
150 0 : rValue >>= xPage;
151 0 : setCurrentPage( xPage );
152 : }
153 0 : break;
154 :
155 : default:
156 0 : throw beans::UnknownPropertyException();
157 : }
158 0 : }
159 :
160 :
161 :
162 :
163 0 : void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& )
164 : throw (::com::sun::star::uno::RuntimeException)
165 : {
166 0 : }
167 :
168 :
169 :
170 :
171 0 : Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
172 : sal_Int32 nHandle)
173 : throw(css::beans::UnknownPropertyException,
174 : css::lang::WrappedTargetException,
175 : css::uno::RuntimeException)
176 : {
177 0 : Any aValue;
178 :
179 0 : switch( nHandle )
180 : {
181 : case DrawController::PROPERTY_CURRENTPAGE:
182 : {
183 0 : SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage();
184 0 : if (pPage != NULL)
185 0 : aValue <<= pPage->getUnoPage();
186 : }
187 0 : break;
188 : case DrawController::PROPERTY_VIEWOFFSET:
189 0 : break;
190 :
191 : default:
192 0 : throw beans::UnknownPropertyException();
193 : }
194 :
195 0 : return aValue;
196 : }
197 :
198 :
199 : // XServiceInfo
200 0 : OUString SAL_CALL SdUnoOutlineView::getImplementationName( ) throw (RuntimeException)
201 : {
202 0 : return OUString("com.sun.star.comp.sd.SdUnoOutlineView");
203 : }
204 :
205 0 : sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
206 : {
207 0 : return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
208 : }
209 :
210 0 : Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException)
211 : {
212 0 : OUString aSN( "com.sun.star.presentation.OutlineView" );
213 0 : uno::Sequence< OUString > aSeq( &aSN, 1 );
214 0 : return aSeq;
215 : }
216 :
217 33 : } // end of namespace sd
218 :
219 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|