Avoid potential negative array index access to cached text.
[LibreOffice.git] / extensions / source / bibliography / bibcont.hxx
blobd90952ac32c30d6a0b79928a33b97df5325c41b1
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 .
20 #pragma once
22 #include <vcl/timer.hxx>
23 #include <vcl/idle.hxx>
24 #include "bibshortcuthandler.hxx"
26 #include "bibmod.hxx"
28 #define TOP_WINDOW 1
29 #define BOTTOM_WINDOW 2
31 class BibWindowContainer : public BibWindow //Window
33 private:
34 // !BibShortCutHandler is also always a Window!
35 BibShortCutHandler* pChild;
37 protected:
38 virtual void Resize() override;
40 public:
41 BibWindowContainer( vcl::Window* pParent, BibShortCutHandler* pChild);
42 virtual ~BibWindowContainer() override;
43 virtual void dispose() override;
45 inline vcl::Window* GetChild();
47 virtual void GetFocus() override;
49 virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled
51 using Window::GetChild;
54 inline vcl::Window* BibWindowContainer::GetChild()
56 return pChild ? pChild->GetWindow() : nullptr;
60 class BibBookContainer: public BibSplitWindow
62 private:
64 VclPtr<BibWindowContainer> pTopWin;
65 VclPtr<BibWindowContainer> pBottomWin;
66 HdlBibModul pBibMod;
67 Idle aIdle;
69 DECL_LINK( SplitHdl, Timer*, void );
71 protected:
73 virtual void Split() override;
75 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
77 public:
79 explicit BibBookContainer(vcl::Window* pParent );
80 virtual ~BibBookContainer() override;
81 virtual void dispose() override;
83 // !BibShortCutHandler is also always a Window!
84 void createTopFrame( BibShortCutHandler* pWin );
86 void createBottomFrame( BibShortCutHandler* pWin );
88 virtual void GetFocus() override;
90 virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */