xref: /trunk/main/sw/source/ui/inc/unotools.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _UNOTOOLS_HXX
28 #define _UNOTOOLS_HXX
29 
30 
31 #include <vcl/dialog.hxx>
32 #include <vcl/fixed.hxx>
33 #include <vcl/edit.hxx>
34 #ifndef _SV_BUTTON_HXX //autogen
35 #include <vcl/button.hxx>
36 #endif
37 #include <actctrl.hxx>
38 #include <com/sun/star/frame/XController.hpp>
39 #include <com/sun/star/text/XTextCursor.hpp>
40 #include <com/sun/star/container/XNameAccess.hpp>
41 #include <com/sun/star/awt/XControl.hpp>
42 #include <com/sun/star/container/XNamed.hpp>
43 #include <tools/resary.hxx>
44 #include <swunodef.hxx>
45 #include "swdllapi.h"
46 
47 /* -----------------------------15.12.99 09:55--------------------------------
48 
49  ---------------------------------------------------------------------------*/
50 class SwOneExampleFrame;
51 class SwFrmCtrlWindow : public Window
52 {
53     SwOneExampleFrame*  pExampleFrame;
54 public:
55     SwFrmCtrlWindow(Window* pParent, WinBits nBits, SwOneExampleFrame*  pFrame);
56 
57     virtual void    Command( const CommandEvent& rCEvt );
58 };
59 /* -----------------------------15.12.99 12:56--------------------------------
60 
61  ---------------------------------------------------------------------------*/
62 class MenuResource : public Resource
63 {
64     ResStringArray      aMenuArray;
65 
66 public:
67     MenuResource(const ResId& rResId);
68 
69     ResStringArray& GetMenuArray() {return aMenuArray;}
70 };
71 /* -----------------27.07.99 15:20-------------------
72 
73  --------------------------------------------------*/
74 #define EX_SHOW_ONLINE_LAYOUT   0x001
75 
76 // hard zoom value
77 #define EX_SHOW_BUSINESS_CARDS  0x02
78 //don't modify page size
79 #define EX_SHOW_DEFAULT_PAGE    0x04
80 
81 class SwView;
82 class SW_DLLPUBLIC SwOneExampleFrame
83 {
84     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >         _xControl;
85     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >         _xModel;
86     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >    _xController;
87     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >     _xCursor;
88 
89     SwFrmCtrlWindow aTopWindow;
90     Window&         rWindow;
91     Timer           aLoadedTimer;
92     Link            aInitializedLink;
93 
94     MenuResource    aMenuRes;
95     String          sArgumentURL;
96 
97     SwView*         pModuleView;
98 
99     sal_uInt32          nStyleFlags;
100 
101     sal_Bool            bIsInitialized;
102     sal_Bool            bServiceAvailable;
103 
104     static  sal_Bool    bShowServiceNotAvailableMessage;
105 
106     SW_DLLPRIVATE DECL_LINK( TimeoutHdl, Timer* );
107     SW_DLLPRIVATE DECL_LINK( PopupHdl, Menu* );
108 
109     SW_DLLPRIVATE void  CreateControl();
110     SW_DLLPRIVATE void  DisposeControl();
111 
112 public:
113     SwOneExampleFrame(Window& rWin,
114                     sal_uInt32 nStyleFlags = EX_SHOW_ONLINE_LAYOUT,
115                     const Link* pInitalizedLink = 0,
116                     String* pURL = 0);
117     ~SwOneExampleFrame();
118 
119     STAR_REFERENCE( awt::XControl ) &       GetControl()    {return _xControl; }
120     STAR_REFERENCE( frame::XModel ) &       GetModel()      {return _xModel;}
121     STAR_REFERENCE( frame::XController ) &  GetController() {return _xController;}
122     STAR_REFERENCE( text::XTextCursor ) &   GetTextCursor() {return _xCursor;}
123 
124     void ClearDocument( sal_Bool bStartTimer = sal_False );
125 
126     sal_Bool IsInitialized() const {return bIsInitialized;}
127     sal_Bool IsServiceAvailable() const {return bServiceAvailable;}
128 
129     void CreatePopup(const Point& rPt);
130 
131     static void     CreateErrorMessage(Window* pParent);
132 };
133 
134 #endif
135 
136