Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _DOCHOLDER_HXX_
30 : : #define _DOCHOLDER_HXX_
31 : :
32 : : #include <com/sun/star/util/XCloseListener.hpp>
33 : : #include <com/sun/star/frame/XTerminateListener.hpp>
34 : : #include <com/sun/star/util/XModifyListener.hpp>
35 : : #include <com/sun/star/util/XCloseable.hpp>
36 : : #include <com/sun/star/document/XEventListener.hpp>
37 : : #include <com/sun/star/frame/XFrame.hpp>
38 : : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
39 : : #include <com/sun/star/frame/XBorderResizeListener.hpp>
40 : : #include <com/sun/star/frame/BorderWidths.hpp>
41 : : #include <com/sun/star/awt/XWindowPeer.hpp>
42 : : #include <com/sun/star/awt/Size.hpp>
43 : : #include <com/sun/star/awt/Rectangle.hpp>
44 : : #include <com/sun/star/embed/XHatchWindowController.hpp>
45 : : #include <com/sun/star/frame/XLayoutManager.hpp>
46 : : #include <cppuhelper/implbase6.hxx>
47 : :
48 : : class OCommonEmbeddedObject;
49 : : class Interceptor;
50 : :
51 : : class DocumentHolder :
52 : : public ::cppu::WeakImplHelper6<
53 : : ::com::sun::star::util::XCloseListener,
54 : : ::com::sun::star::frame::XTerminateListener,
55 : : ::com::sun::star::util::XModifyListener,
56 : : ::com::sun::star::document::XEventListener,
57 : : ::com::sun::star::frame::XBorderResizeListener,
58 : : ::com::sun::star::embed::XHatchWindowController >
59 : : {
60 : : private:
61 : :
62 : : OCommonEmbeddedObject* m_pEmbedObj;
63 : :
64 : : Interceptor* m_pInterceptor;
65 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor;
66 : :
67 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
68 : :
69 : : ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xComponent;
70 : :
71 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
72 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xOwnWindow; // set for inplace objects
73 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xHatchWindow; // set for inplace objects
74 : :
75 : : ::com::sun::star::awt::Rectangle m_aObjRect;
76 : : ::com::sun::star::frame::BorderWidths m_aBorderWidths;
77 : :
78 : : ::rtl::OUString m_aContainerName;
79 : : ::rtl::OUString m_aDocumentNamePart;
80 : :
81 : : sal_Bool m_bReadOnly;
82 : :
83 : : sal_Bool m_bWaitForClose;
84 : : sal_Bool m_bAllowClosing;
85 : : sal_Bool m_bDesktopTerminated;
86 : :
87 : : sal_Int32 m_nNoBorderResizeReact;
88 : : sal_Int32 m_nNoResizeReact;
89 : :
90 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xCachedDocAreaAcc;
91 : :
92 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aOutplaceFrameProps;
93 : :
94 : :
95 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetDocFrame();
96 : : sal_Bool LoadDocToFrame( sal_Bool );
97 : :
98 : : ::com::sun::star::awt::Rectangle CalculateBorderedArea( const ::com::sun::star::awt::Rectangle& aRect );
99 : : ::com::sun::star::awt::Rectangle AddBorderToArea( const ::com::sun::star::awt::Rectangle& aRect );
100 : :
101 : : void ResizeWindows_Impl( const ::com::sun::star::awt::Rectangle& aHatchRect );
102 : :
103 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > RetrieveOwnMenu_Impl();
104 : : sal_Bool MergeMenues_Impl(
105 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xOwnLM,
106 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContLM,
107 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp,
108 : : const ::rtl::OUString& aContModuleName );
109 : :
110 : : public:
111 : :
112 : : static void FindConnectPoints(
113 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMenu,
114 : : sal_Int32 nConnectPoints[2] )
115 : : throw ( ::com::sun::star::uno::Exception );
116 : :
117 : : static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > MergeMenuesForInplace(
118 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xContMenu,
119 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp,
120 : : const ::rtl::OUString& aContModuleName,
121 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xOwnMenu,
122 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xOwnDisp )
123 : : throw ( ::com::sun::star::uno::Exception );
124 : :
125 : :
126 : : DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
127 : : OCommonEmbeddedObject* pEmbObj );
128 : : ~DocumentHolder();
129 : :
130 : 0 : OCommonEmbeddedObject* GetEmbedObject() { return m_pEmbedObj; }
131 : :
132 : : void SetComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& xDoc, sal_Bool bReadOnly );
133 : : void ResizeHatchWindow();
134 : : void LockOffice();
135 : : void FreeOffice();
136 : :
137 : : void CloseDocument( sal_Bool bDeliverOwnership, sal_Bool bWaitForClose );
138 : : void CloseFrame();
139 : :
140 : 0 : rtl::OUString GetTitle() const
141 : : {
142 : 0 : return m_aContainerName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " - " )) + m_aDocumentNamePart;
143 : : }
144 : :
145 : : rtl::OUString GetContainerName() const { return m_aContainerName; }
146 : :
147 : 0 : void SetOutplaceFrameProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aProps )
148 : 0 : { m_aOutplaceFrameProps = aProps; }
149 : :
150 : : void PlaceFrame( const ::com::sun::star::awt::Rectangle& aNewRect );
151 : :
152 : : sal_Bool SetFrameLMVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
153 : : sal_Bool bVisible );
154 : :
155 : : sal_Bool ShowInplace( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
156 : : const ::com::sun::star::awt::Rectangle& aRectangleToShow,
157 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP );
158 : :
159 : : sal_Bool ShowUI(
160 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM,
161 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP,
162 : : const ::rtl::OUString& aContModuleName );
163 : : sal_Bool HideUI(
164 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM );
165 : :
166 : : void Show();
167 : :
168 : : sal_Bool SetExtent( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize );
169 : : sal_Bool GetExtent( sal_Int64 nAspect, ::com::sun::star::awt::Size *pSize );
170 : :
171 : : sal_Int32 GetMapUnit( sal_Int64 nAspect );
172 : :
173 : 0 : void SetOutplaceDispatchInterceptor(
174 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >&
175 : : xOutplaceInterceptor )
176 : : {
177 : 0 : m_xOutplaceInterceptor = xOutplaceInterceptor;
178 : 0 : }
179 : :
180 : 16637 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > GetComponent() { return m_xComponent; }
181 : :
182 : : // XEventListener
183 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
184 : :
185 : : // XCloseListener
186 : : virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
187 : : virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
188 : :
189 : : // XTerminateListener
190 : : virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
191 : : virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
192 : :
193 : : // XModifyListener
194 : : virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException );
195 : :
196 : : // XEventListener
197 : : virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw ( ::com::sun::star::uno::RuntimeException );
198 : :
199 : : // XBorderResizeListener
200 : : virtual void SAL_CALL borderWidthsChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObject, const ::com::sun::star::frame::BorderWidths& aNewSize ) throw (::com::sun::star::uno::RuntimeException);
201 : :
202 : : // XHatchWindowController
203 : : virtual void SAL_CALL requestPositioning( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException);
204 : : virtual ::com::sun::star::awt::Rectangle SAL_CALL calcAdjustedRectangle( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException);
205 : : virtual void SAL_CALL activated( ) throw (::com::sun::star::uno::RuntimeException);
206 : : virtual void SAL_CALL deactivated( ) throw (::com::sun::star::uno::RuntimeException);
207 : : };
208 : :
209 : : #endif
210 : :
211 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|