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