merge the formfield patch from ooo-build
[ooovba.git] / basic / source / app / appwin.hxx
blob95439f2f06325ebe39d65ee4638ee999e75db96a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appwin.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _APPWIN_HXX
32 #define _APPWIN_HXX
34 //#include <sb.hxx>
35 #include <vcl/dockwin.hxx>
36 #include <tools/fsys.hxx>
38 #include "app.hxx"
39 #include "dataedit.hxx"
41 typedef USHORT QueryBits;
42 #define QUERY_NONE ( QueryBits ( 0x00 ) )
43 #define QUERY_DIRTY ( QueryBits ( 0x01 ) )
44 #define QUERY_DISK_CHANGED ( QueryBits ( 0x02 ) )
45 #define QUERY_ALL ( QUERY_DIRTY | QUERY_DISK_CHANGED )
46 #define SAVE_NOT_DIRTY ( QueryBits ( 0x04 ) )
48 #define SAVE_RES_SAVED TRUE
49 #define SAVE_RES_NOT_SAVED FALSE
50 #define SAVE_RES_ERROR 3
51 #define SAVE_RES_CANCEL 4
54 #define SINCE_LAST_LOAD 1
55 #define SINCE_LAST_ASK_RELOAD 2
57 #define HAS_BEEN_LOADED 1 // includes ASKED_RELOAD
58 #define ASKED_RELOAD 2
61 #define TT_WIN_STATE_MAX 0x01
62 #define TT_WIN_STATE_FLOAT 0x02
63 #define TT_WIN_STATE_HIDE 0x04
65 class BasicFrame;
67 class AppWin : public DockingWindow, public SfxListener // Document window
69 friend class MsgEdit;
70 protected:
71 static short nNumber; // serial number
72 static short nCount; // number of edit windows
73 static String *pNoName; // "Untitled"
74 FileStat aLastAccess; // Last access time of loaded file
75 USHORT nSkipReload; // Sometimes there must not be a reload
76 BOOL bHasFile; // Otherwise reload does not make sense
77 BOOL bReloadAborted; // Is set if reload was cancelled so that we can ask again wehn closing
79 short nId; // ID-Nummer( "Unnamed n" )
80 BasicFrame* pFrame; // Parent-Window
81 // Icon* pIcon; // Document icon
82 String aFind; // Search string
83 String aReplace; // Replace string
84 BOOL bFind; // TRUE if search not replace
85 void RequestHelp( const HelpEvent& ); // Help handler
86 void GetFocus(); // activate
87 virtual USHORT ImplSave(); // Save file
88 USHORT nWinState; // Maximized, Iconized or Normal
89 Point nNormalPos; // Position if normal
90 Size nNormalSize; // Size if Normal
91 virtual long PreNotify( NotifyEvent& rNEvt );
92 USHORT nWinId;
94 public:
95 TYPEINFO();
96 AppWin( BasicFrame* );
97 ~AppWin();
98 DataEdit* pDataEdit; // Data area
99 virtual USHORT GetLineNr()=0; // Current line number
100 virtual long InitMenu( Menu* ); // Init of the menu
101 virtual long DeInitMenu( Menu* ); // reset to enable all shortcuts
102 virtual void Command( const CommandEvent& rCEvt ); // Command handler
103 virtual void Resize();
104 virtual void Help();
105 virtual BOOL Load( const String& ); // Load file
106 virtual void PostLoad(){} // Set source at module
107 virtual USHORT SaveAs(); // Save file as
108 virtual void PostSaveAs(){}
109 virtual void Find(); // find text
110 virtual void Replace(); // replace text
111 virtual void Repeat(); // repeat find/replace
112 virtual BOOL Close(); // close window
113 virtual void Activate(); // window was activated
114 virtual FileType GetFileType()=0; // returns the filetype
115 virtual BOOL ReloadAllowed(){ return TRUE; }
116 virtual void Reload(); // Reload after change on disk
117 virtual void LoadIniFile(){;} // (re)load ini file after change
118 void CheckReload(); // Checks and asks if reload should performed
119 BOOL DiskFileChanged( USHORT nWhat ); // Checks file for changes
120 void UpdateFileInfo( USHORT nWhat ); // Remembers last file state
121 BOOL IsSkipReload(); // Should we test reload?
122 void SkipReload( BOOL bSkip = TRUE );
123 USHORT GetWinState(){ return nWinState; }
124 void Maximize();
125 void Restore();
126 void Minimize( BOOL bMinimize );
127 void Cascade( USHORT nNr );
129 USHORT QuerySave( QueryBits nBits = QUERY_ALL );
130 BOOL IsModified() { return pDataEdit->IsModified(); }
131 BasicFrame* GetBasicFrame() { return pFrame; }
132 virtual void TitleButtonClick( USHORT nButton );
133 virtual void SetText( const XubString& rStr );
135 USHORT GetWinId() { return nWinId; }
136 void SetWinId( USHORT nWId ) { nWinId = nWId; }
139 DECLARE_LIST( EditList, AppWin* )
141 #endif