xref: /AOO41X/main/toolkit/source/layout/core/localized-string.cxx (revision b0724fc6948542b2496e16ea247f985ee5987cfe)
1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "localized-string.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <toolkit/helper/property.hxx>
27cdf0e10cSrcweir #include <vcl/window.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace layoutimpl
30cdf0e10cSrcweir {
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace css = ::com::sun::star;
33cdf0e10cSrcweir using namespace css;
34cdf0e10cSrcweir using rtl::OUString;
35cdf0e10cSrcweir 
LocalizedString()36cdf0e10cSrcweir LocalizedString::LocalizedString()
37cdf0e10cSrcweir     : VCLXWindow()
38cdf0e10cSrcweir {
39cdf0e10cSrcweir }
40cdf0e10cSrcweir 
ImplGetPropertyIds(std::list<sal_uInt16> & ids)41cdf0e10cSrcweir void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     PushPropertyIds( ids, BASEPROPERTY_TEXT, 0);
44cdf0e10cSrcweir     VCLXWindow::ImplGetPropertyIds( ids );
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // XInterface
queryInterface(uno::Type const & rType)48cdf0e10cSrcweir uno::Any LocalizedString::queryInterface( uno::Type const& rType )
49cdf0e10cSrcweir     throw(uno::RuntimeException)
50cdf0e10cSrcweir {
51cdf0e10cSrcweir     uno::Any aRet = ::cppu::queryInterface( rType,
52cdf0e10cSrcweir                                             SAL_STATIC_CAST( awt::XFixedText*, this ) );
53cdf0e10cSrcweir     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
54cdf0e10cSrcweir }
55cdf0e10cSrcweir 
setText(OUString const & s)56cdf0e10cSrcweir void LocalizedString::setText( OUString const& s )
57cdf0e10cSrcweir     throw(uno::RuntimeException)
58cdf0e10cSrcweir {
59cdf0e10cSrcweir     ::vos::OGuard aGuard( GetMutex() );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     if ( Window *w = GetWindow() )
62cdf0e10cSrcweir         return w->SetText( s );
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
getText()65cdf0e10cSrcweir OUString LocalizedString::getText()
66cdf0e10cSrcweir     throw(uno::RuntimeException)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir     ::vos::OGuard aGuard( GetMutex() );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     if ( Window *w = GetWindow() )
71cdf0e10cSrcweir         return w->GetText();
72cdf0e10cSrcweir     return OUString();
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir } // namespace layoutimpl
76