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