GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / svtools / source / contnr / templwin.hxx
blobcaf3682591a8dcf09d8cd1a88edc42bc0777b51c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
20 #define INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
22 #include <tools/resary.hxx>
23 #include <vcl/splitwin.hxx>
24 #include <vcl/toolbox.hxx>
25 #include <vcl/window.hxx>
26 #include <svtools/headbar.hxx>
27 #include <svtools/fileview.hxx>
28 #include <svtools/ivctrl.hxx>
29 #include <svtools/svmedit2.hxx>
30 #include <com/sun/star/frame/XDispatch.hpp>
31 #include <com/sun/star/lang/Locale.hpp>
33 namespace com{ namespace sun { namespace star { namespace awt { class XWindow; } } } }
34 namespace com{ namespace sun { namespace star { namespace frame { class XFrame2; } } } }
35 namespace com{ namespace sun { namespace star { namespace document {
36 class XDocumentProperties;
37 } } } }
38 namespace svtools
40 class ODocumentInfoPreview;
43 // class SvtDummyHeaderBar_Impl ------------------------------------------
45 class SvtDummyHeaderBar_Impl : public Window
47 private:
48 void UpdateBackgroundColor();
50 public:
51 SvtDummyHeaderBar_Impl( Window* pParent );
52 ~SvtDummyHeaderBar_Impl();
54 virtual void DataChanged( const DataChangedEvent& rDCEvt );
57 // class SvtIconWindow_Impl ----------------------------------------------
59 class SvtIconWindow_Impl : public Window
61 private:
62 SvtDummyHeaderBar_Impl aDummyHeaderBar; // spaceholder instead of HeaderBar
63 SvtIconChoiceCtrl aIconCtrl;
65 OUString aNewDocumentRootURL;
66 OUString aTemplateRootURL;
67 OUString aMyDocumentsRootURL;
68 OUString aSamplesFolderRootURL;
70 long nMaxTextLength;
72 SvxIconChoiceCtrlEntry* GetEntry( const OUString& rURL ) const;
74 public:
75 SvtIconWindow_Impl( Window* pParent );
76 ~SvtIconWindow_Impl();
78 virtual void Resize();
80 inline long GetMaxTextLength() const { return nMaxTextLength; }
81 inline void SetClickHdl( const Link& rLink ) { aIconCtrl.SetClickHdl( rLink ); }
83 OUString GetSelectedIconURL() const;
84 OUString GetCursorPosIconURL() const;
85 OUString GetIconText( const OUString& rURL ) const;
86 void InvalidateIconControl();
87 void SetCursorPos( sal_uLong nPos );
88 sal_uLong GetCursorPos() const;
89 sal_uLong GetSelectEntryPos() const;
90 void SetFocus();
91 long CalcHeight() const;
92 sal_Bool IsRootURL( const OUString& rURL ) const;
93 sal_uLong GetRootPos( const OUString& rURL ) const;
94 void UpdateIcons();
96 inline sal_Bool ProcessKeyEvent( const KeyEvent& rKEvt );
98 inline const OUString& GetTemplateRootURL() const { return aTemplateRootURL; }
99 inline const OUString& GetMyDocumentsRootURL() const { return aMyDocumentsRootURL; }
100 inline const OUString& GetSamplesFolderURL() const { return aSamplesFolderRootURL; }
102 void SelectFolder(sal_Int32 nFolderPos);
105 inline sal_Bool SvtIconWindow_Impl::ProcessKeyEvent( const KeyEvent& rKEvt )
107 return ( rKEvt.GetKeyCode().IsMod2() ? aIconCtrl.DoKeyInput( rKEvt ) : sal_False );
110 // class SvtFileViewWindow_Impl ------------------------------------------
112 class SvtTemplateWindow;
114 class SvtFileViewWindow_Impl : public Window
116 private:
117 SvtTemplateWindow& rParent;
118 SvtFileView aFileView;
119 Link aNewFolderLink;
120 OUString aCurrentRootURL;
121 OUString aFolderURL;
122 OUString aMyDocumentsURL;
123 OUString aSamplesFolderURL;
125 sal_Bool bIsTemplateFolder;
127 ::com::sun::star::uno::Sequence< OUString >
128 GetNewDocContents() const;
130 public:
131 SvtFileViewWindow_Impl( SvtTemplateWindow* pParent );
132 ~SvtFileViewWindow_Impl();
134 virtual void Resize();
136 inline void SetSelectHdl( const Link& rLink ) { aFileView.SetSelectHdl( rLink ); }
137 inline void SetDoubleClickHdl( const Link& rLink ) { aFileView.SetDoubleClickHdl( rLink ); }
138 inline void SetNewFolderHdl( const Link& rLink ) { aNewFolderLink = rLink; }
139 inline sal_Bool IsTemplateFolder() const { return bIsTemplateFolder; }
140 inline OUString GetFolderURL() const { return aFolderURL; }
141 inline OUString GetRootURL() const { return aCurrentRootURL; }
142 inline void OpenRoot( const OUString& rRootURL )
143 { aCurrentRootURL = rRootURL; OpenFolder( rRootURL ); }
144 inline void SetMyDocumentsURL( const OUString& _rNewURL ) { aMyDocumentsURL = _rNewURL; }
145 inline void SetSamplesFolderURL( const OUString& _rNewURL ) { aSamplesFolderURL = _rNewURL; }
147 OUString GetSelectedFile() const;
148 void OpenFolder( const OUString& rURL );
149 sal_Bool HasPreviousLevel( OUString& rURL ) const;
150 OUString GetFolderTitle() const;
151 void SetFocus();
154 // class SvtFrameWindow_Impl ---------------------------------------------
156 class SvtDocInfoTable_Impl : public ResStringArray
158 public:
159 SvtDocInfoTable_Impl();
161 OUString GetString( long nId ) const;
164 class SvtFrameWindow_Impl : public Window
166 private:
167 ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
168 m_xFrame;
169 ::com::sun::star::uno::Reference < ::com::sun::star::document::XDocumentProperties>
170 m_xDocProps;
171 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
172 xWindow;
174 ::svtools::ODocumentInfoPreview*
175 pEditWin;
176 Window* pTextWin;
177 Window* pEmptyWin;
178 ::com::sun::star::lang::Locale aLocale;
179 SvtDocInfoTable_Impl aInfoTable;
180 OUString aCurrentURL;
181 OUString m_aOpenURL;
182 sal_Bool bDocInfo;
184 void ShowDocInfo( const OUString& rURL );
185 void ViewEditWin();
186 void ViewTextWin();
187 void ViewEmptyWin();
188 void ViewNonEmptyWin(); // views depending on bDocInfo
190 struct SvtExecuteInfo
192 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
193 ::com::sun::star::util::URL aTargetURL;
196 public:
197 SvtFrameWindow_Impl( Window* pParent );
198 ~SvtFrameWindow_Impl();
200 virtual void Resize();
202 void OpenFile( const OUString& rURL, sal_Bool bPreview, sal_Bool bIsTemplate, sal_Bool bAsTemplate );
203 void ToggleView( sal_Bool bDocInfo );
206 // class SvtTemplateWindow -----------------------------------------------
208 struct FolderHistory;
209 typedef ::std::vector< FolderHistory* > HistoryList_Impl;
211 class SvtTemplateWindow : public Window
213 private:
214 ToolBox aFileViewTB;
215 ToolBox aFrameWinTB;
216 SplitWindow aSplitWin;
218 SvtIconWindow_Impl* pIconWin;
219 SvtFileViewWindow_Impl* pFileWin;
220 SvtFrameWindow_Impl* pFrameWin;
221 HistoryList_Impl* pHistoryList;
223 Link aSelectHdl;
224 Link aDoubleClickHdl;
225 Link aNewFolderHdl;
226 Link aSendFocusHdl;
228 Timer aSelectTimer;
230 OUString aFolderTitle;
232 virtual void Resize();
234 DECL_LINK(IconClickHdl_Impl, void *);
235 DECL_LINK(FileSelectHdl_Impl, void *);
236 DECL_LINK(FileDblClickHdl_Impl, void *);
237 DECL_LINK(NewFolderHdl_Impl, void *);
238 DECL_LINK(TimeoutHdl_Impl, void *);
239 DECL_LINK( ClickHdl_Impl, ToolBox* );
240 DECL_LINK(ResizeHdl_Impl, void *); // used for split and initial setting of toolbar pos
242 void PrintFile( const OUString& rURL );
243 void AppendHistoryURL( const OUString& rURL, sal_uLong nGroup );
244 void OpenHistory();
245 void DoAction( sal_uInt16 nAction );
246 void InitToolBoxes();
247 void InitToolBoxImages();
248 void UpdateIcons();
250 protected:
251 virtual long PreNotify( NotifyEvent& rNEvt );
252 virtual void DataChanged( const DataChangedEvent& rDCEvt );
254 public:
255 SvtTemplateWindow( Window* pParent );
256 ~SvtTemplateWindow();
258 inline void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; }
259 inline void SetDoubleClickHdl( const Link& rLink ) { aDoubleClickHdl = rLink; }
260 inline void SetNewFolderHdl( const Link& rLink ) { aNewFolderHdl = rLink; }
261 inline void SetSendFocusHdl( const Link& rLink ) { aSendFocusHdl = rLink; }
262 inline sal_Bool IsTemplateFolderOpen() const { return pFileWin->IsTemplateFolder(); }
263 inline sal_Bool HasIconWinFocus() const { return pIconWin->HasChildPathFocus(); }
265 void ReadViewSettings( );
266 void WriteViewSettings( );
267 sal_Bool IsFileSelected() const;
268 OUString GetSelectedFile() const;
269 void OpenFile( sal_Bool bNotAsTemplate );
270 OUString GetFolderTitle() const;
271 OUString GetFolderURL() const;
272 void SetFocus( sal_Bool bIconWin );
273 void OpenTemplateRoot();
274 void SetPrevLevelButtonState( const OUString& rURL ); // sets state (enable/disable) for previous level button
275 void ClearHistory();
276 long CalcHeight() const;
278 void SelectFolder(sal_Int32 nFolderPosition);
281 #endif // INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */