LCOV - code coverage report
Current view: top level - include/svtools - stdmenu.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 4 0.0 %
Date: 2014-04-11 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          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             : 
      20             : #ifndef _STDMENU_HXX
      21             : #define _STDMENU_HXX
      22             : 
      23             : #include <svtools/svtdllapi.h>
      24             : #include <tools/link.hxx>
      25             : #include <vcl/menu.hxx>
      26             : 
      27             : class FontList;
      28             : class FontInfo;
      29             : 
      30             : /*************************************************************************
      31             : 
      32             : Beschreibung
      33             : ============
      34             : 
      35             : class FontNameMenu
      36             : 
      37             : Beschreibung
      38             : 
      39             : Erlaubt die Auswahl von Fonts. Das Menu wird ueber Fill mit den FontNamen
      40             : gefuellt. Fill sortiert automatisch die FontNamen (inkl. aller Umlaute und
      41             : sprachabhaengig). Mit SetCurName()/GetCurName() kann der aktuelle Fontname
      42             : gesetzt/abgefragt werden. Wenn SetCurName() mit einem leeren String
      43             : aufgerufen wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow).
      44             : Vor dem Selectaufruf wird der ausgewaehlte Name automatisch als aktueller
      45             : gesetzt und wuerde beim naechsten Aufruf auch als aktueller Name angezeigt
      46             : werden. Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit
      47             : SetCurName() der aktuelle Fontname gesetzt werden.
      48             : 
      49             : Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
      50             : Select-Handler gesetzt werden, um die Auswahl eines Namens mitzubekommen.
      51             : 
      52             : In dieses Menu koennen keine weiteren Items eingefuegt werden.
      53             : 
      54             : Spaeter soll auch das Menu die gleichen Bitmaps anzeigen, wie die
      55             : FontNameBox. Auf den Systemen, wo Menues nicht automatisch scrollen,
      56             : wird spaeter wohl ein A-Z Menu ziwschengeschaltet. Da ein Menu bei vielen
      57             : installierten Fonts bisher schon immer lange gebraucht hat, sollte dieses
      58             : Menu schon jetzt nur einmal erzeugt werden (da sonst das Kontextmenu bis
      59             : zu 10-Sekunden fuer die Erzeugung brauchen koennte).
      60             : 
      61             : Querverweise
      62             : 
      63             : FontList; FontSizeMenu; FontNameBox
      64             : 
      65             : --------------------------------------------------------------------------
      66             : 
      67             : class FontSizeMenu
      68             : 
      69             : Beschreibung
      70             : 
      71             : Erlaubt die Auswahl von Fontgroessen. Ueber Fill wird das FontSizeMenu
      72             : gefuellt und ueber GetCurHeight() kann die ausgewaehlte Fontgroesse
      73             : abgefragt werden. Mit SetCurHeight()/GetCurHeight() kann die aktuelle
      74             : Fontgroesse gesetzt/abgefragt werden. Wenn SetCurHeight() mit 0 aufgerufen
      75             : wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow). Vor dem
      76             : Selectaufruf wird die ausgewaehlte Groesse automatisch als aktuelle gesetzt
      77             : und wuerde beim naechsten Aufruf auch als aktuelle Groesse angezeigt werden.
      78             : Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit SetCurHeight()
      79             : die aktuelle Groesse gesetzt werden. Da die Groessen vom ausgewaehlten Font
      80             : abhaengen, sollte nach einer Aenderung des Fontnamen das Menu mit Fill mit
      81             : den Groessen des Fonts neu gefuellt werden.
      82             : 
      83             : Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
      84             : Select-Handler gesetzt werden, um die Auswahl einer Groesse mitzubekommen.
      85             : 
      86             : Alle Groessen werden in 10tel Point angegeben.
      87             : 
      88             : In dieses Menu koennen keine weiteren Items eingefuegt werden.
      89             : 
      90             : Spaeter soll das Menu je nach System die Groessen anders darstelllen. Zum
      91             : Beispiel koennte der Mac spaeter vielleicht einmal die Groessen als Outline
      92             : darstellen, die als Bitmap-Fonts vorhanden sind.
      93             : 
      94             : Querverweise
      95             : 
      96             : FontList; FontNameMenu; FontSizeBox
      97             : 
      98             : *************************************************************************/
      99             : 
     100             : 
     101             : // - FontNameMenu -
     102             : 
     103             : 
     104             : class SVT_DLLPUBLIC FontNameMenu : public PopupMenu
     105             : {
     106             : private:
     107             :     OUString        maCurName;
     108             :     Link            maSelectHdl;
     109             :     Link            maHighlightHdl;
     110             : 
     111             : public:
     112             :                     FontNameMenu();
     113             :     virtual         ~FontNameMenu();
     114             : 
     115             :     virtual void    Select() SAL_OVERRIDE;
     116             :     virtual void    Highlight() SAL_OVERRIDE;
     117             : 
     118             :     void            Fill( const FontList* pList );
     119             : 
     120             :     void            SetCurName( const OUString& rName );
     121           0 :     const OUString& GetCurName() const { return maCurName; }
     122             : 
     123           0 :     void            SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
     124             :     const Link&     GetSelectHdl() const { return maSelectHdl; }
     125             :     void            SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
     126             :     const Link&     GetHighlightHdl() const { return maHighlightHdl; }
     127             : };
     128             : 
     129             : 
     130             : // - FontSizeMenu -
     131             : 
     132             : 
     133             : class SVT_DLLPUBLIC FontSizeMenu : public PopupMenu
     134             : {
     135             : private:
     136             :     long*           mpHeightAry;
     137             :     long            mnCurHeight;
     138             :     Link            maSelectHdl;
     139             :     Link            maHighlightHdl;
     140             : 
     141             : public:
     142             :                     FontSizeMenu();
     143             :                     virtual ~FontSizeMenu();
     144             : 
     145             :     virtual void    Select() SAL_OVERRIDE;
     146             :     virtual void    Highlight() SAL_OVERRIDE;
     147             : 
     148             :     void            Fill( const FontInfo& rInfo, const FontList* pList );
     149             : 
     150             :     void            SetCurHeight( long nHeight );
     151           0 :     long            GetCurHeight() const { return mnCurHeight; }
     152             : 
     153           0 :     void            SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
     154             :     const Link&     GetSelectHdl() const { return maSelectHdl; }
     155             :     void            SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
     156             :     const Link&     GetHighlightHdl() const { return maHighlightHdl; }
     157             : };
     158             : 
     159             : #endif  // _STDMENU_HXX
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10