1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX 25 #define SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX 26 27 #include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx> 28 29 /** === begin UNO includes === **/ 30 #include <com/sun/star/uno/Reference.hxx> 31 /** === end UNO includes === **/ 32 #include <rtl/ref.hxx> 33 #include <svx/svxdllapi.h> 34 35 class OutputDevice; 36 class Window; 37 class SdrUnoObj; 38 namespace com { namespace sun { namespace star { 39 namespace awt { 40 class XControl; 41 class XControlContainer; 42 } 43 } } } 44 45 //........................................................................ 46 namespace sdr { namespace contact { 47 //........................................................................ 48 49 class ViewContactOfUnoControl; 50 class ObjectContactOfPageView; 51 //==================================================================== 52 //= ViewObjectContactOfUnoControl 53 //==================================================================== 54 class ViewObjectContactOfUnoControl_Impl; 55 class SVX_DLLPRIVATE ViewObjectContactOfUnoControl : public ViewObjectContactOfSdrObj 56 { 57 protected: 58 ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl; 59 60 public: 61 ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); 62 /// determines whether an XControl already exists, and is currently visible 63 bool isControlVisible() const; 64 65 /// returns the ->XControl instance belonging to the instance, creates it if necessary 66 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > 67 getControl(); 68 69 /** retrieves a temporary XControl instance, whose parent is the given device 70 @seealso SdrUnoObj::GetTemporaryControlForWindow 71 */ 72 static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > 73 getTemporaryControlForWindow( 74 const Window& _rWindow, 75 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _inout_ControlContainer, 76 const SdrUnoObj& _rUnoObject 77 ); 78 79 /// ensures that the control belonging to this instances has a given visibility 80 void ensureControlVisibility( bool _bVisible ) const; 81 82 /** sets the design/alive mode of the control 83 */ 84 void setControlDesignMode( bool _bDesignMode ) const; 85 86 /** callback from impl class to react on changes of properties form the XControlModel 87 */ 88 void propertyChange(); 89 90 /** React on changes of the object of this ViewContact 91 */ 92 virtual void ActionChanged(); 93 94 /** to be called when any aspect of the control which requires view updates changed 95 */ ImplAccesssdr::contact::ViewObjectContactOfUnoControl::ImplAccess96 struct ImplAccess { friend class ViewObjectContactOfUnoControl_Impl; friend class ViewObjectContactOfUnoControl; private: ImplAccess() { } }; onControlChangedOrModified(ImplAccess)97 void onControlChangedOrModified( ImplAccess ) { impl_onControlChangedOrModified(); } 98 99 protected: 100 ~ViewObjectContactOfUnoControl(); 101 102 // support for Primitive2D 103 virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; 104 105 // visibility check 106 virtual bool isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const; 107 /// to be called when any aspect of the control which requires view updates changed 108 void impl_onControlChangedOrModified(); 109 110 private: 111 ViewObjectContactOfUnoControl(); // never implemented 112 ViewObjectContactOfUnoControl( const ViewObjectContactOfUnoControl& ); // never implemented 113 ViewObjectContactOfUnoControl& operator=( const ViewObjectContactOfUnoControl& ); // never implemented 114 }; 115 116 //==================================================================== 117 //= UnoControlPrintOrPreviewContact 118 //==================================================================== 119 class SVX_DLLPRIVATE UnoControlPrintOrPreviewContact : public ViewObjectContactOfUnoControl 120 { 121 public: 122 UnoControlPrintOrPreviewContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ); 123 ~UnoControlPrintOrPreviewContact(); 124 125 private: 126 UnoControlPrintOrPreviewContact(); // never implemented 127 UnoControlPrintOrPreviewContact( const UnoControlPrintOrPreviewContact& ); // never implemented 128 UnoControlPrintOrPreviewContact& operator=( const UnoControlPrintOrPreviewContact& ); // never implemented 129 130 virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const; 131 }; 132 133 //........................................................................ 134 } } // namespace sdr::contact 135 //........................................................................ 136 137 #endif // SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX 138 139