xref: /trunk/main/desktop/source/deployment/gui/descedit.cxx (revision ec11f87ab23355e4c8e2c7dc62ff9c677fbd0971)
12722ceddSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32722ceddSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42722ceddSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52722ceddSAndrew Rist  * distributed with this work for additional information
62722ceddSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72722ceddSAndrew Rist  * to you under the Apache License, Version 2.0 (the
82722ceddSAndrew Rist  * "License"); you may not use this file except in compliance
92722ceddSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
112722ceddSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
132722ceddSAndrew Rist  * Unless required by applicable law or agreed to in writing,
142722ceddSAndrew Rist  * software distributed under the License is distributed on an
152722ceddSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162722ceddSAndrew Rist  * KIND, either express or implied.  See the License for the
172722ceddSAndrew Rist  * specific language governing permissions and limitations
182722ceddSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
202722ceddSAndrew Rist  *************************************************************/
212722ceddSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_desktop.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <vcl/scrbar.hxx>
26cdf0e10cSrcweir #include <svtools/txtattr.hxx>
27cdf0e10cSrcweir #include <svtools/xtextedt.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "descedit.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "dp_gui.hrc"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using dp_gui::DescriptionEdit;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // DescriptionEdit -------------------------------------------------------
36cdf0e10cSrcweir 
DescriptionEdit(Window * pParent,const ResId & rResId)37cdf0e10cSrcweir DescriptionEdit::DescriptionEdit( Window* pParent, const ResId& rResId ) :
38cdf0e10cSrcweir 
39cdf0e10cSrcweir     ExtMultiLineEdit( pParent, rResId ),
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     m_bIsVerticalScrollBarHidden( true )
42cdf0e10cSrcweir 
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     Init();
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // -----------------------------------------------------------------------
48cdf0e10cSrcweir 
Init()49cdf0e10cSrcweir void DescriptionEdit::Init()
50cdf0e10cSrcweir {
51cdf0e10cSrcweir     Clear();
52cdf0e10cSrcweir     // no tabstop
53cdf0e10cSrcweir     SetStyle( ( GetStyle() & ~WB_TABSTOP ) | WB_NOTABSTOP );
54cdf0e10cSrcweir     // read-only
55cdf0e10cSrcweir     SetReadOnly();
56cdf0e10cSrcweir     // no cursor
57cdf0e10cSrcweir     EnableCursor( sal_False );
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir // -----------------------------------------------------------------------
61cdf0e10cSrcweir 
UpdateScrollBar()62cdf0e10cSrcweir void DescriptionEdit::UpdateScrollBar()
63cdf0e10cSrcweir {
64cdf0e10cSrcweir     if ( m_bIsVerticalScrollBarHidden )
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir         ScrollBar*  pVScrBar = GetVScrollBar();
67cdf0e10cSrcweir         if ( pVScrBar && pVScrBar->GetVisibleSize() < pVScrBar->GetRangeMax() )
68cdf0e10cSrcweir         {
69cdf0e10cSrcweir             pVScrBar->Show();
70cdf0e10cSrcweir             m_bIsVerticalScrollBarHidden = false;
71cdf0e10cSrcweir         }
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir // -----------------------------------------------------------------------
76cdf0e10cSrcweir 
Clear()77cdf0e10cSrcweir void DescriptionEdit::Clear()
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     SetText( String() );
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     m_bIsVerticalScrollBarHidden = true;
82cdf0e10cSrcweir     ScrollBar*  pVScrBar = GetVScrollBar();
83cdf0e10cSrcweir     if ( pVScrBar )
84cdf0e10cSrcweir         pVScrBar->Hide();
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir // -----------------------------------------------------------------------
88cdf0e10cSrcweir 
SetDescription(const String & rDescription)89cdf0e10cSrcweir void DescriptionEdit::SetDescription( const String& rDescription )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     SetText( rDescription );
92cdf0e10cSrcweir     UpdateScrollBar();
93cdf0e10cSrcweir }
94*ec11f87aSmseidel 
95*ec11f87aSmseidel /* vim: set noet sw=4 ts=4: */
96