xref: /trunk/main/sfx2/source/view/viewfac.cxx (revision d119d52d)
1*d119d52dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*d119d52dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*d119d52dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*d119d52dSAndrew Rist  * distributed with this work for additional information
6*d119d52dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*d119d52dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*d119d52dSAndrew Rist  * "License"); you may not use this file except in compliance
9*d119d52dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d119d52dSAndrew Rist  *
11*d119d52dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d119d52dSAndrew Rist  *
13*d119d52dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*d119d52dSAndrew Rist  * software distributed under the License is distributed on an
15*d119d52dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d119d52dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*d119d52dSAndrew Rist  * specific language governing permissions and limitations
18*d119d52dSAndrew Rist  * under the License.
19*d119d52dSAndrew Rist  *
20*d119d52dSAndrew Rist  *************************************************************/
21*d119d52dSAndrew Rist 
22*d119d52dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <sfx2/app.hxx>
29cdf0e10cSrcweir #include "sfx2/viewfac.hxx"
30cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
33cdf0e10cSrcweir 
DBG_NAME(SfxViewFactory)34cdf0e10cSrcweir DBG_NAME(SfxViewFactory)
35cdf0e10cSrcweir 
36cdf0e10cSrcweir SfxViewShell *SfxViewFactory::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldSh )
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	DBG_CHKTHIS(SfxViewFactory, 0);
39cdf0e10cSrcweir 	return (*fnCreate)(pFrame, pOldSh);
40cdf0e10cSrcweir }
41cdf0e10cSrcweir 
InitFactory()42cdf0e10cSrcweir void SfxViewFactory::InitFactory()
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	DBG_CHKTHIS(SfxViewFactory, 0);
45cdf0e10cSrcweir 	(*fnInit)();
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
GetLegacyViewName() const48cdf0e10cSrcweir String SfxViewFactory::GetLegacyViewName() const
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     ::rtl::OUStringBuffer aViewName;
51cdf0e10cSrcweir     aViewName.appendAscii( "view" );
52cdf0e10cSrcweir     aViewName.append( sal_Int32( GetOrdinal() ) );
53cdf0e10cSrcweir     return aViewName.makeStringAndClear();
54cdf0e10cSrcweir }
55cdf0e10cSrcweir 
GetAPIViewName() const56cdf0e10cSrcweir String SfxViewFactory::GetAPIViewName() const
57cdf0e10cSrcweir {
58cdf0e10cSrcweir     if ( m_sViewName.Len() > 0 )
59cdf0e10cSrcweir         return m_sViewName;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     if ( GetOrdinal() == 0 )
62cdf0e10cSrcweir         return String::CreateFromAscii( "Default" );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     return GetLegacyViewName();
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // CTOR / DTOR -----------------------------------------------------------
68cdf0e10cSrcweir 
SfxViewFactory(SfxViewCtor fnC,SfxViewInit fnI,sal_uInt16 nOrdinal,const sal_Char * asciiViewName)69cdf0e10cSrcweir SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI,
70cdf0e10cSrcweir 								sal_uInt16 nOrdinal, const sal_Char* asciiViewName ):
71cdf0e10cSrcweir 	fnCreate(fnC),
72cdf0e10cSrcweir 	fnInit(fnI),
73cdf0e10cSrcweir 	nOrd(nOrdinal),
74cdf0e10cSrcweir     m_sViewName( String::CreateFromAscii( asciiViewName ) )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	DBG_CTOR(SfxViewFactory, 0);
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
~SfxViewFactory()79cdf0e10cSrcweir SfxViewFactory::~SfxViewFactory()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	DBG_DTOR(SfxViewFactory, 0);
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85