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