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 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOTOOLS_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTOOLS_HXX
21 :
22 : #include <vcl/button.hxx>
23 : #include <vcl/edit.hxx>
24 : #include <vcl/dialog.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/layout.hxx>
27 : #include <vcl/idle.hxx>
28 : #include <actctrl.hxx>
29 : #include <com/sun/star/frame/XController.hpp>
30 : #include <com/sun/star/text/XTextCursor.hpp>
31 : #include <com/sun/star/container/XNameAccess.hpp>
32 : #include <com/sun/star/awt/XControl.hpp>
33 : #include <com/sun/star/container/XNamed.hpp>
34 : #include <tools/resary.hxx>
35 : #include "swdllapi.h"
36 :
37 : class SwOneExampleFrame;
38 :
39 0 : class SwFrmCtrlWindow : public VclEventBox
40 : {
41 : SwOneExampleFrame* pExampleFrame;
42 : public:
43 : SwFrmCtrlWindow(vcl::Window* pParent, SwOneExampleFrame* pFrame);
44 :
45 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
46 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
47 : virtual void Resize() SAL_OVERRIDE;
48 : };
49 :
50 0 : class MenuResource : public Resource
51 : {
52 : ResStringArray aMenuArray;
53 :
54 : public:
55 : MenuResource(const ResId& rResId);
56 :
57 0 : ResStringArray& GetMenuArray() {return aMenuArray;}
58 : };
59 :
60 : #define EX_SHOW_ONLINE_LAYOUT 0x001
61 :
62 : // hard zoom value
63 : #define EX_SHOW_BUSINESS_CARDS 0x02
64 : //don't modify page size
65 : #define EX_SHOW_DEFAULT_PAGE 0x04
66 :
67 : class SwView;
68 :
69 : class SW_DLLPUBLIC SwOneExampleFrame
70 : {
71 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _xControl;
72 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > _xModel;
73 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController;
74 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor;
75 :
76 : VclPtr<SwFrmCtrlWindow> aTopWindow;
77 : Idle aLoadedIdle;
78 : Link<> aInitializedLink;
79 :
80 : MenuResource aMenuRes;
81 : OUString sArgumentURL;
82 :
83 : SwView* pModuleView;
84 :
85 : sal_uInt32 nStyleFlags;
86 :
87 : bool bIsInitialized;
88 : bool bServiceAvailable;
89 :
90 : static bool bShowServiceNotAvailableMessage;
91 :
92 : DECL_DLLPRIVATE_LINK_TYPED( TimeoutHdl, Idle*, void );
93 : DECL_DLLPRIVATE_LINK( PopupHdl, Menu* );
94 :
95 : SAL_DLLPRIVATE void CreateControl();
96 : SAL_DLLPRIVATE void DisposeControl();
97 :
98 : public:
99 : SwOneExampleFrame(vcl::Window& rWin,
100 : sal_uInt32 nStyleFlags = EX_SHOW_ONLINE_LAYOUT,
101 : const Link<>* pInitalizedLink = 0,
102 : const OUString* pURL = 0);
103 : ~SwOneExampleFrame();
104 :
105 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > & GetControl() {return _xControl; }
106 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & GetModel() {return _xModel;}
107 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & GetController() {return _xController;}
108 0 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > & GetTextCursor() {return _xCursor;}
109 :
110 : void ClearDocument( bool bStartTimer = false );
111 :
112 0 : bool IsInitialized() const {return bIsInitialized;}
113 0 : bool IsServiceAvailable() const {return bServiceAvailable;}
114 :
115 : void CreatePopup(const Point& rPt);
116 :
117 : static void CreateErrorMessage(vcl::Window* pParent);
118 : };
119 :
120 : #endif
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|