xref: /aoo4110/main/svx/source/svdraw/svdoutl.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <svx/svdoutl.hxx>
27 #include <editeng/outliner.hxx>
28 #include <svx/svdotext.hxx>
29 #include <editeng/editstat.hxx>
30 #include <svx/svdmodel.hxx>
31 #include <editeng/eeitem.hxx>
32 #include <svl/itempool.hxx>
33 
DBG_NAME(SdrOutliner)34 DBG_NAME(SdrOutliner)
35 /*************************************************************************
36 |*
37 |* Ctor
38 |*
39 \************************************************************************/
40 SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
41 :	Outliner( pItemPool, nMode ),
42 	//mpPaintInfoRec( NULL )
43 	mpVisualizedPage(0)
44 {
45     DBG_CTOR(SdrOutliner,NULL);
46 }
47 
48 
49 /*************************************************************************
50 |*
51 |* Dtor
52 |*
53 \************************************************************************/
~SdrOutliner()54 SdrOutliner::~SdrOutliner()
55 {
56     DBG_DTOR(SdrOutliner,NULL);
57 }
58 
59 
60 /*************************************************************************
61 |*
62 |*
63 |*
64 \************************************************************************/
SetTextObj(const SdrTextObj * pObj)65 void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
66 {
67 	if( pObj && pObj != mpTextObj.get() )
68 	{
69 		SetUpdateMode(sal_False);
70 		sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
71 		if ( !pObj->IsOutlText() )
72 			nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
73 		Init( nOutlinerMode2 );
74 
75 		SetGlobalCharStretching(100,100);
76 
77 		sal_uIntPtr nStat = GetControlWord();
78 		nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
79 		SetControlWord(nStat);
80 
81 		Size aNullSize;
82 		Size aMaxSize( 100000,100000 );
83 		SetMinAutoPaperSize( aNullSize );
84 		SetMaxAutoPaperSize( aMaxSize );
85 		SetPaperSize( aMaxSize );
86 		ClearPolygon();
87 	}
88 
89 	mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
90 }
91 
92 /*************************************************************************
93 |*
94 |*
95 |*
96 \************************************************************************/
SetTextObjNoInit(const SdrTextObj * pObj)97 void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
98 {
99 	mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
100 }
101 
102 /*************************************************************************
103 |*
104 |*
105 |*
106 \************************************************************************/
CalcFieldValue(const SvxFieldItem & rField,sal_uInt16 nPara,sal_uInt16 nPos,Color * & rpTxtColor,Color * & rpFldColor)107 XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
108                                      Color*& rpTxtColor, Color*& rpFldColor)
109 {
110 	FASTBOOL bOk = sal_False;
111 	XubString aRet;
112 
113 	if(mpTextObj.is())
114 		bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
115 
116 	if (!bOk)
117 		aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
118 
119 	return aRet;
120 }
121 
GetTextObj() const122 const SdrTextObj* SdrOutliner::GetTextObj() const
123 {
124 	if( mpTextObj.is() )
125 		return static_cast< SdrTextObj* >( mpTextObj.get() );
126 	else
127 		return 0;
128 }
129